-
-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathsetup.py
More file actions
78 lines (67 loc) · 2.5 KB
/
setup.py
File metadata and controls
78 lines (67 loc) · 2.5 KB
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
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
import re
import sys
class PyTest(TestCommand):
"""Custom test command that uses pytest"""
user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def run_tests(self):
import subprocess
import sys
# Install pytest if not available
try:
import pytest
except ImportError:
print("Installing pytest...")
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'pytest'])
import pytest
# Run pytest
errno = pytest.main(['tests/'] + self.pytest_args)
sys.exit(errno)
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the README file
with open(os.path.join(here, 'README.rst')) as f:
long_description = f.read()
# Read version from pcpp/pcmd.py without importing it
with open(os.path.join(here, 'pcpp', 'pcmd.py')) as f:
content = f.read()
version_match = re.search(r"^version=['\"]([^'\"]*)['\"]", content, re.M)
if version_match:
version = version_match.group(1)
else:
raise RuntimeError("Unable to find version string.")
setup(
name='pcpp',
version=version,
description='A C99 preprocessor written in pure Python',
long_description=long_description,
author='Niall Douglas and David Beazley',
url='https://github.com/ned14/pcpp',
packages=['pcpp', 'pcpp.ply.ply'],
package_data={'pcpp' : ['../LICENSE.txt']},
entry_points={
'console_scripts': [ 'pcpp=pcpp:main' ]
},
options={'bdist_wheel':{'universal':False}}, # Changed to False since we're Python 3 only now
license='BSD',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
cmdclass={'test': PyTest},
)