|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
3 | | -from setuptools import setup, find_packages |
4 | | -import os, pcpp |
| 3 | +from setuptools import setup |
| 4 | +import os |
| 5 | +import re |
5 | 6 |
|
6 | 7 | here = os.path.abspath(os.path.dirname(__file__)) |
7 | 8 |
|
8 | 9 | # Get the long description from the README file |
9 | 10 | with open(os.path.join(here, 'README.rst')) as f: |
10 | 11 | long_description = f.read() |
11 | | - |
| 12 | + |
| 13 | +# Read version from pcpp/pcmd.py without importing it |
| 14 | +with open(os.path.join(here, 'pcpp', 'pcmd.py')) as f: |
| 15 | + content = f.read() |
| 16 | + version_match = re.search(r"^version=['\"]([^'\"]*)['\"]", content, re.M) |
| 17 | + if version_match: |
| 18 | + version = version_match.group(1) |
| 19 | + else: |
| 20 | + raise RuntimeError("Unable to find version string.") |
| 21 | + |
12 | 22 | setup( |
13 | 23 | name='pcpp', |
14 | | - version=pcpp.version, |
| 24 | + version=version, |
15 | 25 | description='A C99 preprocessor written in pure Python', |
16 | 26 | long_description=long_description, |
17 | 27 | author='Niall Douglas and David Beazley', |
18 | 28 | url='https://github.com/ned14/pcpp', |
19 | | - packages=['pcpp', 'pcpp/ply/ply'], |
| 29 | + packages=['pcpp', 'pcpp.ply.ply'], |
20 | 30 | package_data={'pcpp' : ['../LICENSE.txt']}, |
21 | 31 | test_suite='tests', |
22 | 32 | entry_points={ |
|
28 | 38 | 'Development Status :: 5 - Production/Stable', |
29 | 39 | 'Intended Audience :: Developers', |
30 | 40 | 'Topic :: Software Development :: Build Tools', |
31 | | - 'License :: OSI Approved :: BSD License', |
32 | 41 | 'Programming Language :: Python :: 3', |
33 | 42 | 'Programming Language :: Python :: 3 :: Only', |
34 | 43 | 'Programming Language :: Python :: 3.6', |
|
0 commit comments