|
28 | 28 |
|
29 | 29 | import os
|
30 | 30 |
|
31 |
| -from setuptools import setup, Command |
| 31 | +from pathlib import Path |
| 32 | +from shutil import copytree, which |
32 | 33 | from tempfile import TemporaryDirectory
|
33 |
| -from shutil import copytree |
34 | 34 | from zipapp import create_archive
|
35 | 35 |
|
| 36 | +from setuptools import Command, setup |
| 37 | + |
36 | 38 |
|
37 | 39 | ##############################################################################
|
38 | 40 | # Dont touch below
|
39 | 41 |
|
40 | 42 |
|
41 | 43 | class ZipApp(Command):
|
42 |
| - description, user_options = "Creates a zipapp.", [] |
| 44 | + description, user_options = "Creates a ZipApp.", [] |
43 | 45 |
|
44 | 46 | def initialize_options(self): pass # Dont needed, but required.
|
45 | 47 |
|
46 | 48 | def finalize_options(self): pass # Dont needed, but required.
|
47 | 49 |
|
48 | 50 | def run(self):
|
49 | 51 | with TemporaryDirectory() as tmpdir:
|
50 |
| - copytree('.', os.path.join(tmpdir, 'css-html-js-minify')) |
51 |
| - fyle = os.path.join(tmpdir, '__main__.py') |
52 |
| - with open(fyle, 'w', encoding='utf-8') as entry: |
53 |
| - entry.write("import runpy\nrunpy.run_module('css-html-js-minify')") |
54 |
| - create_archive(tmpdir, 'css-html-js-minify.pyz', '/usr/bin/env python3', "css-html-js-minify") |
| 52 | + copytree('.', Path(tmpdir) / 'css-html-js-minify') |
| 53 | + (Path(tmpdir) / '__main__.py').write_text("import runpy\nrunpy.run_module('css-html-js-minify')") |
| 54 | + create_archive(tmpdir, 'css-html-js-minify.pyz', which('python3')) |
55 | 55 |
|
56 | 56 |
|
57 | 57 | ##############################################################################
|
58 | 58 |
|
59 | 59 |
|
60 | 60 | setup(
|
61 |
| - install_requires=['anglerfish'], |
| 61 | + install_requires=['anglerfish'],css-html-js-minify.py |
62 | 62 | setup_requires=['anglerfish'],
|
63 | 63 | tests_require=['anglerfish'],
|
64 |
| - requires=['anglerfish'], |
| 64 | + requires=['anglerfish'],css-html-js-minify.py |
65 | 65 |
|
66 | 66 | # scripts=['css-html-js-minify.py'], # uncomment if want install as script
|
67 | 67 |
|
|
0 commit comments