-
Notifications
You must be signed in to change notification settings - Fork 81
/
setup.py
40 lines (30 loc) · 1.04 KB
/
setup.py
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
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
# Parse the version from the file.
verstrline = open('git_archive_all.py', "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise RuntimeError("Unable to find version string in git_archive_all.py")
class PyTest(TestCommand):
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 shlex
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
setup(
version=verstr,
py_modules=['git_archive_all'],
package_data={'git_archive_all': ['py.typed', '*.pyi']},
entry_points={'console_scripts': 'git-archive-all=git_archive_all:main'},
cmdclass={"test": PyTest},
)