-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
82 lines (67 loc) · 2.15 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
# lucam/setup.py
"""Lucam package Setuptools script."""
import sys
import re
from setuptools import setup
def search(pattern, code, flags=0):
# return first match for pattern in code
match = re.search(pattern, code, flags)
if match is None:
raise ValueError(f'{pattern!r} not found')
return match.groups()[0]
with open('lucam/lucam.py') as fh:
code = fh.read()
version = search(r"__version__ = '(.*?)'", code)
description = search(r'"""(.*)\.(?:\r\n|\r|\n)', code)
readme = search(
r'(?:\r\n|\r|\n){2}"""(.*)"""(?:\r\n|\r|\n){2}[__version__|from]',
code,
re.MULTILINE | re.DOTALL,
)
readme = '\n'.join(
[description, '=' * len(description)] + readme.splitlines()[1:]
)
license = search(
r'(# Copyright.*?(?:\r\n|\r|\n))(?:\r\n|\r|\n)+""',
code,
re.MULTILINE | re.DOTALL,
)
license = license.replace('# ', '').replace('#', '')
if 'sdist' in sys.argv:
with open('LICENSE', 'w') as fh:
fh.write('BSD 3-Clause License\n\n')
fh.write(license)
with open('README.rst', 'w') as fh:
fh.write(readme)
setup(
name='lucam',
version=version,
license='BSD',
description=description,
long_description=readme,
author='Christoph Gohlke',
author_email='[email protected]',
url='https://www.cgohlke.com',
project_urls={
'Bug Tracker': 'https://github.com/cgohlke/lucam/issues',
'Source Code': 'https://github.com/cgohlke/lucam',
# 'Documentation': 'https://',
},
packages=['lucam'],
python_requires='>=3.7',
install_requires=['numpy>=1.15.1'],
platforms=['Windows'],
classifiers=[
'Development Status :: 7 - Inactive',
'License :: OSI Approved :: BSD License',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3 :: Only',
'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',
],
)