-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
172 lines (148 loc) · 6.22 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/env python
import glob
import os
import subprocess
import sys
sys.path.append(r"C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375")
from distutils.command.build_py import build_py as _build_py
from distutils.core import setup
from setuptools import find_packages
#from setuptools.command.build_py import build_py as _build_py
#from setuptools import setup, find_packages
import FluidNexus
from FluidNexus.BuildManpage import build_manpage
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
'textile',
'simplejson',
'pybonjour',
'sqlalchemy',
'oauth2',
]
if sys.version_info[:3] < (2,5,0):
requires.append('pysqlite')
if (sys.platform.startswith("linux")):
os_name = "posix"
elif (sys.platform == "win32"):
os_name = "windows"
elif (sys.platform == "darwin"):
os_name = "darwin"
if (os_name == "windows"):
import py2exe
if (os_name == "darwin"):
setup_requires = ["py2app"]
else:
setup_requires = []
def get_messages():
"""Get the QT translations."""
msgfiles = []
for filename in os.listdir("l10n/"):
if filename.endswith(".qm"):
msgfiles.append("l10n/%s" % filename)
return msgfiles
def get_manual_images():
"""Get all of the images in the manual."""
manual_filenames = []
for dirpath, dirs, filenames in os.walk(os.path.join("share", "fluid-nexus", "manual", "images")):
manual_filenames.extend([os.path.join(dirpath, filename) for filename in filenames])
return manual_filenames
def regen_messages():
"""Regenerate QT translations."""
for filename in os.listdir("l10n/"):
if filename.endswith(".ts"):
outFile = filename.replace(".ts", ".qm")
command = ["lconvert", "-i", "l10n/%s" % filename, "-o", "l10n/%s" % outFile]
subprocess.call(command)
class build_py(_build_py):
"""Builds our PyQt files from the ui files."""
def run(self):
uis = []
for filename in os.listdir(os.path.join("FluidNexus", "ui")):
if filename.endswith(".ui"):
uis.append(os.path.join("FluidNexus", "ui", filename))
for ui in uis:
out = ui.replace(".ui", "UI.py")
if (os_name == "windows"):
command = ["pyuic4.bat", ui, "-o", out]
else:
command = ["pyuic4", ui, "-o", out]
# For some reason pyuic4 doesn't want to work here...
subprocess.call(command)
self.byte_compile(out)
res = "FluidNexus/ui/FluidNexus_rc.py"
if (os_name == "windows"):
command = ["pyrcc4.exe", "FluidNexus/ui/res/FluidNexus.qrc", "-o", res]
else:
command = ["pyrcc4", "FluidNexus/ui/res/FluidNexus.qrc", "-o", res]
subprocess.call(command)
# Removing the language conversion for now
#if (os_name != "windows"):
# regen_messages()
_build_py.run(self)
# Add in our manual and translation files
data_files = [("share/fluid-nexus/l10n", get_messages()),
("share/applications", ["share/applications/fluid-nexus.desktop"]),
("share/pixmaps", ["share/pixmaps/fluid-nexus.png"]),
("share/fluid-nexus/manual", ["share/fluid-nexus/manual/index.html"]),
("share/fluid-nexus/manual/images", get_manual_images())]
# Add in Visual Studio runtime on windows
if (os_name == "windows"):
data_files.append(("Microsoft.VC90.CRT", glob.glob(r"C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375\*.*")))
data_files.append(("Microsoft.VC90.CRT", [r"scripts\Microsoft.VC90.CRT.manifest"]))
setup(name='fluid-nexus',
version=FluidNexus.__version__,
description='PyQt4 application that enables one to share messages and data independent of centralized data networks',
author='Nicholas Knouf',
author_email='[email protected]',
url='http://fluidnexus.net',
download_url="http://fluidnexus.net/download",
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: X11 Applications :: Qt",
"Environment :: Win32 (MS Windows)",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Topic :: Artistic Software",
"Topic :: Communications",
],
keywords=["ad-hoc networking", "activism", "bluetooth", "zeroconf", "communication"],
packages=find_packages(),
package_data={"FluidNexus.ui":["*.ui"]},
data_files = data_files,
scripts=["scripts/fluid-nexus"],
setup_requires=setup_requires,
zipfile = "lib/library.zip",
windows=[{
"script": "scripts/fluid-nexus",
"icon_resources": [(1, "FluidNexus/ui/res/icons/fluid_nexus_icon.ico")]}],
app=["FluidNexusApp.py"],
options = {
"py2exe": {
"includes": ["sip", "simplejson", "pysqlite2", "google.protobuf", "sqlalchemy"],
"packages": ["sqlalchemy.dialects.sqlite", "FluidNexus.ui"]
},
"py2app": {
"argv_emulation": True,
"iconfile": "FluidNexus/ui/res/icons/fluid_nexus_icon.icns",
"includes": ["sip", "LightAquaBlue", "lightblue", "pysqlite2", "simplejson", "sqlalchemy", "google.protobuf", "sqlalchemy.dialects.sqlite"],
"packages": ["Foundation"],
"plist": dict(
CFBundleName = "FluidNexus",
CFBundleShortVersionString = FluidNexus.version.__version__, # must be in X.X.X format
CFBundleGetInfoString = "Fluid Nexus %s" % FluidNexus.version.__version__,
#CFBundleExecutable = "FluidNexusApp.py",
CFBundleIdentifier = "net.fluidnexus.FluidNexus",
),
},
},
include_package_data=True,
zip_safe=False,
install_requires = requires,
cmdclass={"build_py": build_py, "build_manpage": build_manpage}
)