forked from ciotto/css-html-js-minify
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathsetup.py
68 lines (53 loc) · 1.88 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# To generate DEB package from Python Package:
# sudo pip3 install stdeb
# python3 setup.py --verbose --command-packages=stdeb.command bdist_deb
#
#
# To generate RPM package from Python Package:
# sudo apt-get install rpm
# python3 setup.py bdist_rpm --verbose --fix-python --binary-only
#
#
# To generate EXE MS Windows from Python Package (from MS Windows only):
# python3 setup.py bdist_wininst --verbose
#
#
# To generate PKGBUILD ArchLinux from Python Package (from PyPI only):
# sudo pip3 install git+https://github.com/bluepeppers/pip2arch.git
# pip2arch.py PackageNameHere
#
#
# To Upload to PyPI by executing:
# python3 setup.py register
# python3 setup.py bdist_egg sdist --formats=zip upload --sign
import os
from pathlib import Path
from shutil import copytree, which
from tempfile import TemporaryDirectory
from zipapp import create_archive
from setuptools import Command, setup
##############################################################################
# Dont touch below
class ZipApp(Command):
description, user_options = "Creates a ZipApp.", []
def initialize_options(self): pass # Dont needed, but required.
def finalize_options(self): pass # Dont needed, but required.
def run(self):
with TemporaryDirectory() as tmpdir:
copytree('.', Path(tmpdir) / 'css-html-js-minify')
(Path(tmpdir) / '__main__.py').write_text("import runpy\nrunpy.run_module('css-html-js-minify')")
create_archive(tmpdir, 'css-html-js-minify.pyz', which('python3'))
##############################################################################
setup(
# scripts=['css-html-js-minify.py'], # uncomment if want install as script
entry_points={
'console_scripts': [
"css-html-js-minify = css_html_js_minify.minify:main",
],
},
cmdclass={"zipapp": ZipApp},
)