forked from FoldingAtHome/fah-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
128 lines (105 loc) · 3.57 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
import sys
import os
import inspect
dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
if dir == '': dir = '.'
print ('dir = %s' % dir)
os.chdir(dir)
# Convert glade data
in_file = 'fah/FAHControl.glade'
out_file = 'fah/FAHControl_glade.py'
if os.path.exists(in_file):
input = None
output = None
try:
input = open(in_file, 'r')
output = open(out_file, 'w')
output.write('# -*- coding: utf8 -*-\n\n')
output.write('glade_data = """')
output.write(input.read())
output.write('"""\n')
finally:
if input is not None: input.close()
if output is not None: output.close()
# Bootstrap
try:
import ez_setup
ez_setup.use_setuptools()
except: pass
app = 'FAHControl'
if sys.platform == 'darwin':
from setuptools import setup
plist = dict(
CFBundleDisplayName = 'FAHControl',
CFBundleIdentifier = 'org.foldingathome.fahcontrol',
CFBundleSignature = '????',
NSHumanReadableCopyright = 'Copyright 2010-2018 foldingathome.org',
)
options = dict(
argv_emulation = False,
includes = 'cairo, pango, pangocairo, atk, gobject, gio',
iconfile = 'images/FAHControl.icns',
resources = ['/opt/local/share/themes'],
plist = plist,
)
extra_opts = dict(
app = [app],
options = {'py2app': options},
setup_requires = ['py2app'],
)
# Hack around py2app problem with python scripts with out .py extension.
from py2app.util import PY_SUFFIXES
PY_SUFFIXES.append('')
elif sys.platform == 'win32':
from cx_Freeze import setup, Executable
# Change base to 'Console' for debugging
e = Executable(app, base = 'Win32GUI', icon = 'images/FAHControl.ico')
options = {
'build_exe': {
'build_exe': 'gui',
'includes': 'gtk'
}
}
extra_opts = dict(executables = [e], options = options)
else:
from setuptools import setup, find_packages
extra_opts = dict(
packages = find_packages(),
scripts = [app],
data_files = [('/usr/share/pixmaps', ['images/FAHControl.png'])],
install_requires = 'gtk2 >= 2.14.0',
include_package_data = True,
)
try:
version = open('version.txt').read().strip()
version.split('.')
except: version = '0.0.0'
if not os.path.exists('fah/Version.py') or version != '0.0.0':
open('fah/Version.py', 'w').write('version = \'%s\'\n' % version)
description = \
'''Folding@home is a distributed computing project using volunteered
computer resources.
'''
short_description = '''
This package contains FAHControl, a graphical monitor and control
utility for the Folding@home client. It gives an overview of running
projects on the local and optional (remote) machines. Starting,
stopping and pausing of the running projects is also possible, as is
viewing the logs. It provides an Advanced view with
additional information and settings for enthusiasts and gurus.'''
description += short_description
setup(
name = 'FAHControl',
version = version,
description = 'Folding@home Client Control',
long_description = description,
author = 'Joseph Coffland',
author_email = '[email protected]',
license = 'GNU General Public License version 3',
keywords = 'protein, molecular dynamics, simulation',
url = 'https://foldingathome.org/',
package_data = {'fah': ['*.glade']},
**extra_opts)
if sys.platform == 'darwin':
with open('package-description.txt', 'w') as f:
f.write(short_description.strip())