Skip to content

Commit 027f09e

Browse files
committed
Moved some metadata into setup.cfg
1 parent 8b15073 commit 027f09e

File tree

5 files changed

+66
-82
lines changed

5 files changed

+66
-82
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
arpeggio/version.py
2+
13
*.py[cod]
24

35
# C extensions
@@ -55,4 +57,4 @@ docs/_build
5557
site
5658
.cache
5759
venv
58-
.ropeproject
60+
.ropeproject

arpeggio/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
import bisect
1919
from arpeggio.utils import isstr
2020
import types
21-
22-
__version__ = "1.9.2"
21+
from .version import __version__
2322

2423
if sys.version < '3':
2524
text = unicode

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = ["setuptools>=41", "wheel", "setuptools_scm[toml]>=3.4.3"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
write_to_template = "__version__ = \"{version}\"\n"
7+
write_to = "arpeggio/version.py"

setup.cfg

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
[metadata]
2-
description-file = README.rst
2+
name = Arpeggio
3+
author = Igor R. Dejanovic
4+
author_email = igor.dejanovic@gmail.com
5+
maintainer = Igor R. Dejanovic
6+
maintainer_email = igor.dejanovic@gmail.com
7+
license = MIT
38
license_file = LICENSE
9+
description = Packrat parser interpreter
10+
long_description = file: README.rst
11+
long_description_content_type = text/x-rst
12+
keywords = parser, packrat, peg
13+
url = https://github.com/textX/Arpeggio
14+
classifiers =
15+
Development Status :: 5 - Production/Stable
16+
Intended Audience :: Developers
17+
Intended Audience :: Information Technology
18+
Intended Audience :: Science/Research
19+
Topic :: Software Development :: Interpreters
20+
Topic :: Software Development :: Compilers
21+
Topic :: Software Development :: Libraries :: Python Modules
22+
License :: OSI Approved :: MIT License
23+
Operating System :: OS Independent
24+
Programming Language :: Python :: 2
25+
Programming Language :: Python :: 2.7
26+
Programming Language :: Python :: 3
27+
Programming Language :: Python :: 3.4
28+
Programming Language :: Python :: 3.5
29+
Programming Language :: Python :: 3.6
30+
Programming Language :: Python :: 3.7
31+
Programming Language :: Python :: 3.8
32+
33+
[options]
34+
packages = find:
35+
test_suite = "arpeggio.tests"
36+
setup_requires = setuptools>=41; wheel; setuptools_scm[toml]>=3.4.3
37+
tests_require = pytest-runner; pytest
438

539
[bdist_wheel]
6-
universal=1
40+
universal = 1
741

842
[aliases]
9-
test=pytest
43+
test = pytest
1044

1145
[tool:pytest]
1246
addopts = --verbose
13-
python_files = arpeggio/tests/*.py
47+
python_files = arpeggio/tests/*.py

setup.py

Lines changed: 17 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,84 +12,26 @@
1212
# Parsers are defined using python language construction or PEG language.
1313
###############################################################################
1414

15-
import codecs
1615
import os
1716
import sys
1817
from setuptools import setup, find_packages
1918

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")
4735
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-
]
9436

95-
)
37+
setup()

0 commit comments

Comments
 (0)