|
12 | 12 | # Parsers are defined using python language construction or PEG language. |
13 | 13 | ############################################################################### |
14 | 14 |
|
15 | | -import codecs |
16 | 15 | import os |
17 | 16 | import sys |
18 | 17 | from setuptools import setup, find_packages |
19 | 18 |
|
20 | | -VERSIONFILE = "arpeggio/__init__.py" |
21 | | -VERSION = None |
22 | | -for line in codecs.open(VERSIONFILE, "r", encoding='utf-8').readlines(): |
23 | | - if line.startswith('__version__'): |
24 | | - VERSION = line.split('"')[1] |
25 | | - |
26 | | -if not VERSION: |
27 | | - raise RuntimeError('No version defined in arpeggio/__init__.py') |
28 | | - |
29 | | -README = codecs.open(os.path.join(os.path.dirname(__file__), 'README.rst'), |
30 | | - 'r', encoding='utf-8').read() |
31 | | - |
32 | | -NAME = 'Arpeggio' |
33 | | -DESC = 'Packrat parser interpreter' |
34 | | -AUTHOR = 'Igor R. Dejanovic' |
35 | | -AUTHOR_EMAIL = 'igor.dejanovic@gmail.com' |
36 | | -LICENSE = 'MIT' |
37 | | -URL = 'https://github.com/textX/Arpeggio' |
38 | | -DOWNLOAD_URL = 'https://github.com/textX/Arpeggio/archive/v{}.tar.gz'\ |
39 | | - .format(VERSION) |
40 | | - |
41 | | -if sys.argv[-1].startswith('publish'): |
42 | | - if os.system("pip list | grep wheel"): |
43 | | - print("wheel not installed.\nUse `pip install wheel`.\nExiting.") |
44 | | - sys.exit() |
45 | | - if os.system("pip list | grep twine"): |
46 | | - print("twine not installed.\nUse `pip install twine`.\nExiting.") |
| 19 | +if __name__ == "__main__": |
| 20 | + if sys.argv[-1].startswith('publish'): |
| 21 | + if os.system("pip3 list | grep wheel"): |
| 22 | + print("wheel not installed.\nUse `pip install wheel`.\nExiting.") |
| 23 | + sys.exit() |
| 24 | + if os.system("pip3 list | grep twine"): |
| 25 | + print("twine not installed.\nUse `pip install twine`.\nExiting.") |
| 26 | + sys.exit() |
| 27 | + os.system("python3 -m pep517.build -bs -o ./dist") |
| 28 | + if sys.argv[-1] == 'publishtest': |
| 29 | + os.system("twine upload -r test dist/*") |
| 30 | + else: |
| 31 | + os.system("twine upload dist/*") |
| 32 | + print("You probably want to also tag the version now:") |
| 33 | + print(" git tag -a {0} -m 'version {0}'".format(VERSION)) |
| 34 | + print(" git push --tags") |
47 | 35 | sys.exit() |
48 | | - os.system("python setup.py sdist bdist_wheel") |
49 | | - if sys.argv[-1] == 'publishtest': |
50 | | - os.system("twine upload -r test dist/*") |
51 | | - else: |
52 | | - os.system("twine upload dist/*") |
53 | | - print("You probably want to also tag the version now:") |
54 | | - print(" git tag -a {0} -m 'version {0}'".format(VERSION)) |
55 | | - print(" git push --tags") |
56 | | - sys.exit() |
57 | | - |
58 | | -setup( |
59 | | - name=NAME, |
60 | | - version=VERSION, |
61 | | - description=DESC, |
62 | | - long_description=README, |
63 | | - author=AUTHOR, |
64 | | - author_email=AUTHOR_EMAIL, |
65 | | - maintainer=AUTHOR, |
66 | | - maintainer_email=AUTHOR_EMAIL, |
67 | | - license=LICENSE, |
68 | | - url=URL, |
69 | | - download_url=DOWNLOAD_URL, |
70 | | - packages=find_packages(), |
71 | | - setup_requires=['pytest-runner'], |
72 | | - tests_require=['pytest'], |
73 | | - test_suite="arpeggio.tests", |
74 | | - keywords="parser packrat peg", |
75 | | - classifiers=[ |
76 | | - 'Development Status :: 5 - Production/Stable', |
77 | | - 'Intended Audience :: Developers', |
78 | | - 'Intended Audience :: Information Technology', |
79 | | - 'Intended Audience :: Science/Research', |
80 | | - 'Topic :: Software Development :: Interpreters', |
81 | | - 'Topic :: Software Development :: Compilers', |
82 | | - 'Topic :: Software Development :: Libraries :: Python Modules', |
83 | | - 'License :: OSI Approved :: MIT License', |
84 | | - 'Operating System :: OS Independent', |
85 | | - 'Programming Language :: Python :: 2', |
86 | | - 'Programming Language :: Python :: 2.7', |
87 | | - 'Programming Language :: Python :: 3', |
88 | | - 'Programming Language :: Python :: 3.4', |
89 | | - 'Programming Language :: Python :: 3.5', |
90 | | - 'Programming Language :: Python :: 3.6', |
91 | | - 'Programming Language :: Python :: 3.7', |
92 | | - 'Programming Language :: Python :: 3.8' |
93 | | - ] |
94 | 36 |
|
95 | | -) |
| 37 | + setup() |
0 commit comments