-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py.bk
executable file
·96 lines (75 loc) · 2.86 KB
/
setup.py.bk
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
95
96
#!/usr/bin/env python
# Copyright©2021, Regents of the University of California
# http://creativecommons.org/licenses/BSD
"""Setup for EZID
Front end to setuptools, generates installer metadata and provides a convenient way
of setting up EZID locally.
Example usage in a pyenv based development environment:
Setup:
$ python install --upgrade pip wheel
$ python setup.py develop
$ pyenv rehash
* Find available EZID tools by typing `ez-<tab>` on the shell.
Create a wheel install file:
python install --upgrade pip wheel
python setup.py bdist_wheel
"""
import os
import pathlib
import setuptools
EZID_META = dict(
name='ezid',
version='3.0.0',
packages=setuptools.find_packages(),
# include_package_data=True,
url='https://ezid.cdlib.org/',
license='http://creativecommons.org/licenses/BSD/',
author='Regents of the University of California',
author_email='',
description='EZID',
setup_requires=[
"setuptools_git >= 1.1",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
keywords="persistent identifier id",
)
HERE_PATH = pathlib.Path(__file__).parent
def gen_console_scripts():
"""Generate command line stubs for the modules in the tools folders."""
tool_path = HERE_PATH / 'tools'
stub_list = []
for p in tool_path.glob('*.py'):
if p.name.startswith('_'):
continue
module_name = p.with_suffix('').name
tool_name = 'ez-{}'.format(module_name.replace('_', '-'))
stub_name = "{}=tools.{}:main".format( tool_name, module_name)
stub_list.append(stub_name)
return stub_list
def gen_install_requires():
"""Generate the list of setup dependencies based on the ./requirements.txt file
We generate install_requires by using the dependencies declared in requirements.txt
and modifying the versions to "pinned" instead of "compatible with".
For the differences between `install_requires` and `requirements.txt`, see
https://packaging.python.org/discussions/install-requires-vs-requirements/.
"""
req_path = HERE_PATH / 'requirements.txt'
return [req.replace('~=', '==').strip() for req in req_path.open().readlines()]
# TODO: Adjust as needed and call
def mk_paths():
"""Create directories required by EZID"""
(HERE_PATH / '../logs').mkdir(parents=True, exist_ok=True)
(HERE_PATH / '../download/public').mkdir(parents=True, exist_ok=True)
(HERE_PATH / './db').mkdir(parents=True, exist_ok=True)
(HERE_PATH / '../logs/transaction.log').touch()
setuptools.setup(
**EZID_META,
entry_points={"console_scripts": gen_console_scripts()},
install_requires=gen_install_requires(),
)