This repository has been archived by the owner on Oct 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsetup.py
100 lines (83 loc) · 2.55 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
from __future__ import with_statement
from setuptools import setup, find_packages
from distutils import log
from collections import defaultdict
from os.path import join
import os
import apaf
from apaf import config
APP = [os.path.join('apaf', 'main.py')]
# static files
DATA_FILES = [(root, [join(root, file) for file in files])
for root, _, files in os.walk(join('datadir'))]
PLATFORM_OPTIONS = defaultdict(dict)
## DARWIN options. ##
if config.platform == 'darwin':
import operator
import py2app
from apaf.ui.darwin import OSXPatchCommand
else:
OSXPatchCommand = None
OPTIONS_PY2APP = dict(
argv_emulation = True,
iconfile=join(config.drawable_dir, 'logo.icns'),
plist = dict(
LSUIElement=True, # Agent Only App (No icon in dock)
),
includes = ['txtorcon', 'apaf.run.darwin'],
# install_requires=['py2app>=0.6.4'],
)
PLATFORM_OPTIONS['darwin'] = dict(
cmdclass={
'osx_patch': OSXPatchCommand,
},
)
## WINDOWS otions. ##
if config.platform == 'win32':
import py2exe
#Generate the blob module for static files, too.
from apaf.blobber import create_blobbone
create_blobbone(config.data_dir,
join(config.package_dir, 'blobbone.py'))
PLATFORM_OPTIONS['win32'] = dict(
zipfile = None,
console = APP,
# windows = APP, # run as window, not console application.
)
OPTIONS_PY2EXE = dict(
bundle_files = 1,
compressed = True,
optimize = 2,
includes =['apaf.run.win32']
# install_requires=['py2exe>=0.6.9', 'pywin32'],
)
## linux options ##
if config.platform == 'linux2':
DATA_FILES = [(join('share', config.appname, dest), source)
for dest, source in DATA_FILES]
## manual page ##
mandir = join('docs', 'build', 'man')
if os.path.exists(join(mandir, 'apaf.1')):
DATA_FILES.append((join('share', 'man', 'man1'),
[join(mandir, 'apaf.1')]))
## Dependencies ##
requirements = None
with open('requirements.txt') as dependencies:
requirements = [dependency.strip() for dependency in dependencies]
setup(
name=config.appname,
description=config.description,
version=apaf.__version__,
author=apaf.__author__,
author_email=apaf.__email__,
url=apaf.__url__,
app=APP,
data_files=DATA_FILES,
options=dict(py2app=OPTIONS_PY2APP,
py2exe=OPTIONS_PY2EXE,
),
install_requires=open('requirements.txt').readlines(),
entry_points=dict(console_scripts=['apaf = apaf.main']),
packages=find_packages(exclude=['test']),
**PLATFORM_OPTIONS[config.platform]
)