-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·94 lines (81 loc) · 3.08 KB
/
setup.py
File metadata and controls
executable file
·94 lines (81 loc) · 3.08 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from distutils.core import setup
from distutils.command.sdist import sdist
from distutils.dir_util import copy_tree
from pathlib import PurePath
from platform import python_implementation
from typing import List
from tempfile import TemporaryDirectory
from setuptools import find_packages
__author__ = 'Leif Johansson'
__version__ = '2.1.0dev0'
class NPMSdist(sdist):
def run(self):
import subprocess
npm_modules = load_requirements(here.with_name('npm_modules.txt'))
with TemporaryDirectory() as tmp:
for npm_module in npm_modules:
subprocess.check_call(['npm', 'install', '--production', '--prefix', tmp, npm_module])
for npm_module in npm_modules:
(npm_module_path, _, _) = npm_module.rpartition('@')
copy_tree(
"{}/node_modules/{}/dist".format(tmp, npm_module_path), './src/pyff/web/{}'.format(npm_module_path)
)
super().run()
def load_requirements(path: PurePath) -> List[str]:
""" Load dependencies from a requirements.txt style file, ignoring comments etc. """
res = []
with open(path) as fd:
for line in fd.readlines():
while line.endswith('\n') or line.endswith('\\'):
line = line[:-1]
line = line.strip()
if not line or line.startswith('-') or line.startswith('#'):
continue
res += [line]
return res
here = PurePath(__file__)
README = open(here.with_name('README.rst')).read()
NEWS = open(here.with_name('NEWS.txt')).read()
install_requires = load_requirements(here.with_name('requirements.txt'))
tests_require = load_requirements(here.with_name('test_requirements.txt'))
python_implementation_str = python_implementation()
setup(
name='pyFF',
cmdclass={'sdist': NPMSdist},
version=__version__,
description="Federation Feeder",
long_description=README + '\n\n' + NEWS,
classifiers=[
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
keywords='identity federation saml metadata',
author=__author__,
author_email='leifj@sunet.se',
url='https://pyff.io',
license='BSD',
tests_require=tests_require,
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
package_data={'pyff': ['xslt/*.xsl', 'schema/*.xsd', 'web/**/*']},
zip_safe=False,
install_requires=install_requires,
scripts=['scripts/mirror-mdq.sh'],
entry_points={
'console_scripts': ['pyff=pyff.md:main', 'pyffd=pyff.mdq:main', 'samldiff=pyff.tools:difftool'],
'paste.app_factory': ['pyffapp=pyff.wsgi:app_factory'],
'paste.server_runner': ['pyffs=pyff.wsgi:server_runner'],
},
message_extractors={
'src': [
('**.py', 'python', None),
('**/templates/**.html', 'mako', None),
]
},
python_requires='>=3.7',
)