Uh oh!
There was an error while loading. Please reload this page.
forked from xmlsec/python-xmlsec
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
125 lines (100 loc) · 3.98 KB
/
Copy pathsetup.py
File metadata and controls
125 lines (100 loc) · 3.98 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# from __future__ import absolute_import, unicode_literals, division
fromosimportpath
frompkgutilimportget_importer
fromsetuptoolsimportsetup, Extension
fromfunctoolsimportwraps
deflazy(function):
@wraps(function)
defwrapped(*args, **kwargs):
classLazyProxy(Extension):
__arguments=dict()
def__init__(self, function, args, kwargs):
self.__arguments["function"] =function
self.__arguments["args"] =args
self.__arguments["kwargs"] =kwargs
self.__arguments["result"] =None
def__getattr__(self, item):
ifself.__arguments["result"] isNone:
self.__arguments["result"] =self.__arguments["function"](*self.__arguments["args"],
**self.__arguments["kwargs"])
returngetattr(self.__arguments["result"], item)
def__setattr__(self, name, value):
ifself.__arguments["result"] isNone:
self.__arguments["result"] =self.__arguments["function"](*self.__arguments["args"],
**self.__arguments["kwargs"])
setattr(self.__arguments["result"], name, value)
returnLazyProxy(function, args, kwargs)
returnwrapped
@lazy
defmake_extension(name, cython=True):
frompkgconfigimportparse
# Declare the crypto implementation.
xmlsec_crypto='openssl'
# Process the `pkg-config` utility and discover include and library
# directories.
config= {}
forlibin ['libxml-2.0', 'xmlsec1-%s'%xmlsec_crypto]:
config.update(parse(lib))
config['extra_compile_args'] = ['-DXMLSEC_CRYPTO_OPENSSL=1', '-DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1']
# List-ify config for setuptools.
forkeyinconfig:
config[key] =list(config[key])
if'include_dirs'notinconfig:
config['include_dirs'] = []
# Add the source directories for inclusion.
importlxml
config['include_dirs'].insert(0, path.dirname(lxml.__file__))
config['include_dirs'].insert(0, path.join(path.dirname(lxml.__file__), 'includes'))
config['include_dirs'].insert(0, 'src')
# Resolve extension location from name.
location=path.join('src', *name.split('.'))
location+='.pyx'ifcythonelse'.c'
# Create and return the extension.
returnExtension(name, [location], **config)
# Navigate, import, and retrieve the metadata of the project.
meta=get_importer('src/xmlsec').find_module('meta').load_module('meta')
setup(
name='xmlsec',
version=meta.version,
description=meta.description,
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Cython',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Text Processing :: Markup :: XML'
],
author='Ryan Leckey',
author_email='support@mehcode.com',
url='https://github.com/mehcode/python-xmlsec',
setup_requires=[
'setuptools_cython',
'pkgconfig',
'lxml >= 3.0',
],
install_requires=[
'lxml >= 3.0',
],
extras_require={
'test': ['pytest']
},
package_dir={'xmlsec': 'src/xmlsec'},
packages=['xmlsec'],
ext_modules=[
make_extension('xmlsec.constants'),
make_extension('xmlsec.utils'),
make_extension('xmlsec.tree'),
make_extension('xmlsec.key'),
make_extension('xmlsec.ds'),
make_extension('xmlsec.enc'),
make_extension('xmlsec.template'),
]
)