-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
94 lines (74 loc) · 2.33 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Author: Yipeng Sun <syp at umd dot edu>
# License: BSD 2-clause
# Last Change: Wed Sep 01, 2021 at 04:37 PM +0200
import setuptools
import subprocess
import sys
import codecs
import os.path
from setuptools.command.test import test as TestCommand
from distutils.core import setup
###########
# Helpers #
###########
with open('README.md', 'r') as ld:
long_description = ld.read()
def get_pipe_output(cmd):
cmd_splitted = cmd.split(' ')
proc = subprocess.Popen(cmd_splitted, stdout=subprocess.PIPE)
result = proc.stdout.read().decode('utf-8')
return result.strip('\n')
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
#########
# Setup #
#########
setup(
name='pyBabyMaker',
version=get_version('pyBabyMaker/__init__.py'),
author='Yipeng Sun',
author_email='[email protected]',
description='Python babymaker (flat ntuple generation tool) library',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/umd-lhcb/pyBabyMaker',
packages=setuptools.find_packages(),
scripts=['bin/ntpdump', 'bin/babymaker', 'bin/debugmaker'],
include_package_data=True,
install_requires=[
'pyyaml',
'lark-parser',
'uproot',
'lz4'
],
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent'
],
tests_require=['pytest'],
test_suite="test",
cmdclass={'test': PyTest}
)