diff --git a/.travis.yml b/.travis.yml index a46aa5e8..7785b7c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ python: - "3.6" - "3.7" - "3.8" - -install: pip install -U tox-travis +install: + - pip install -U tox-travis pip setuptools setuptools_scm wheel + - python3 ./setup.py bdist_wheel + - pip install ./dist/*.whl script: tox diff --git a/parglare/__init__.py b/parglare/__init__.py index 134232d5..73d7c3ca 100644 --- a/parglare/__init__.py +++ b/parglare/__init__.py @@ -10,5 +10,4 @@ from parglare.exceptions import ParserInitError, ParseError, GrammarError, \ DisambiguationError - -__version__ = "0.12.0" +from .version import __version__ diff --git a/setup.cfg b/setup.cfg index abfc151e..53a1ac6f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,44 @@ +[metadata] +name = parglare +author = Igor R. Dejanovic +author_email = igorREPLACEWITHDOTdejanovic@gmail.com +license = MIT +description = A pure Python Scannerless LR/GLR parser +keywords = parglare +url = https://github.com/igordejanovic/parglare +long_description = file: README.rst +classifiers = + Development Status :: 4 - Beta + Intended Audience :: Developers + Intended Audience :: Information Technology + Intended Audience :: Science/Research + Topic :: Software Development :: Interpreters + Topic :: Software Development :: Compilers + Topic :: Software Development :: Libraries :: Python Modules + License :: OSI Approved :: MIT License + Natural Language :: English + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Operating System :: OS Independent + +[options] +packages = parglare, parglare.tables +zip_safe = False +install_requires = click +include_package_data = True +tests_require = flake8; tox; coverage; coveralls; pytest +package_dir = + parglare = parglare +test_suite = tests +setup_requires = setuptools_scm; + +[options.entry_points] +console_scripts = pglr = parglare.cli:pglr + [bumpversion] current_version = 0.1.0 commit = True diff --git a/setup.py b/setup.py index 37049fbc..61625c1e 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -import os import sys -import codecs +import os from setuptools import setup - -VERSIONFILE = "parglare/__init__.py" -VERSION = None -for line in open(VERSIONFILE, "r").readlines(): - if line.startswith('__version__'): - VERSION = line.split('"')[1] - -if not VERSION: - raise RuntimeError('No version defined in parglare.__init__.py') - - -README = codecs.open(os.path.join(os.path.dirname(__file__), 'README.rst'), - 'r', encoding='utf-8').read() +from pathlib import Path +this_dir = Path(__file__).absolute().parent if sys.argv[-1].startswith('publish'): if os.system("pip list | grep wheel"): @@ -30,60 +18,11 @@ os.system("twine upload -r test dist/*") else: os.system("twine upload dist/*") - print("You probably want to also tag the version now:") - print(" git tag -a {0} -m 'version {0}'".format(VERSION)) - print(" git push --tags") + print("You probably want to also tag the version now.") sys.exit() - -setup( - name='parglare', - version=VERSION, - description="A pure Python Scannerless LR/GLR parser", - long_description=README, - author="Igor R. Dejanovic", - author_email='igorREPLACEWITHDOTdejanovic@gmail.com', - url='https://github.com/igordejanovic/parglare', - packages=[ - 'parglare', - 'parglare.tables' - ], - package_dir={'parglare': - 'parglare'}, - include_package_data=True, - install_requires=['click'], - tests_require=[ - 'flake8', - 'tox', - 'coverage', - 'coveralls', - 'pytest', - ], - test_suite='tests', - license="MIT license", - zip_safe=False, - keywords='parglare', - entry_points={ - 'console_scripts': [ - 'pglr = parglare.cli:pglr' - ] - }, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'Intended Audience :: Science/Research', - 'Topic :: Software Development :: Interpreters', - 'Topic :: Software Development :: Compilers', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Operating System :: OS Independent', - ] -) +if __name__ == "__main__": + setup(use_scm_version={ + "write_to": str(this_dir / "parglare" / "version.py"), + "write_to_template": '__version__ = "{version}"\n', + })