forked from JuniorPolegato/pole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
115 lines (104 loc) · 4.48 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from setuptools import setup, Extension
from setuptools.command.install import install
import os
import ConfigParser
try:
import pkgconfig
cflags = pkgconfig.cflags('xmlsec1').replace('\\', '')
if not cflags:
raise
libs = pkgconfig.libs('xmlsec1')
except Exception:
import traceback
print '-' * 100
traceback.print_exc()
print '-' * 100
import platform
cflags = ("-DXMLSEC_CRYPTO=\"openssl\" -D__XMLSEC_FUNCTION__=__FUNCTION__"
" -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1"
" -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_OPENSSL_100=1"
" -DXMLSEC_CRYPTO_OPENSSL=1"
" -I/usr/include/libxml2 -I/usr/include/xmlsec1")
if platform.uname()[4] == 'x86_64':
cflags = "-DXMLSEC_NO_SIZE_T " + cflags
libs = "-lxmlsec1-openssl -lxmlsec1 -lssl -lcrypto -lxslt -lxml2"
config = ConfigParser.ConfigParser()
config.read('setup.cfg')
locale_dir = config.get("compile_catalog", "directory")
domain = config.get("compile_catalog", "domain")
locale_files = [(os.path.join('share', 'locale', locale, 'LC_MESSAGES'),
[os.path.join(locale_dir, locale, 'LC_MESSAGES',
domain + ".mo")])
for locale in os.listdir(locale_dir)]
gladepy_files = [(os.path.join('share', 'pole', 'gladepy'),
[os.path.join('gladepy', '.gladepy.conf'),
os.path.join('gladepy', 'glade-code-generator')])]
glade_files = [(os.path.join('share', 'pole', 'glade'),
reduce(lambda x, y: x + y,
[[os.path.join(top, f) for f in files
if f.rsplit('.', 1)[-1] in ("deb", "patch", "txt")]
for top, dirs, files
in os.walk('gladepy/patch_glade-3_3.6.7')]))]
nfe_files = [(os.path.join('share', 'pole', top),
[os.path.join(top, f) for f in files])
for top, dirs, files in os.walk('NFe') if files]
class xinstall(install):
def run(self):
from babel.messages.frontend import compile_catalog
po_compiler = compile_catalog(self.distribution)
po_compiler.initialize_options()
po_compiler.domain = domain
po_compiler.directory = locale_dir
po_compiler.finalize_options()
po_compiler.run()
install.run(self)
setup(
name=domain,
version='1.1.5',
author='Junior Polegato',
author_email='linux@juniorpolegato.com.br',
packages=[domain],
package_dir={domain: 'src/' + domain},
scripts=['gladepy/gladepy.py'],
message_extractors={'src/' + domain: [('**.py', 'python', None)]},
data_files=locale_files + gladepy_files + glade_files + nfe_files,
url='http://pypi.python.org/pypi/pole/',
license='LICENSE.txt',
description=('A micro framework for PyGtk, PDF, XML, Utilities'
' and Brazilan NFe.'),
long_description=open('README.md').read(),
keywords=['pole', 'pygtk', 'gtk', 'gtk+', 'nfe', 'xml', 'pdf', 'util'],
# install_requires=['cairo >= 1.1.0', 'cx_Oracle >= 5.1.0',
# 'dateutil >= 0.1.0', 'gtk2 >= 2.16.0',
# 'lxml >= 3.0.0', 'pytz >= 2008.0.0',
# 'reportlab >= 3.0.0', 'suds >= 0.7],
ext_modules=[
Extension(
'pole.PoleXmlSec',
sources=['src/pole/PoleXmlSec.c'],
extra_compile_args=cflags.split(),
extra_link_args=libs.split())],
cmdclass={'install': xinstall},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: X11 Applications',
'Environment :: X11 Applications :: GTK',
'Environment :: Console',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows :: Windows NT/2000',
'Operating System :: Microsoft',
'Operating System :: OS Independent',
'Operating System :: POSIX :: Linux',
'Programming Language :: C',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Libraries',
'Topic :: Utilities',
],
)