-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py.win
More file actions
executable file
·85 lines (76 loc) · 2.33 KB
/
setup.py.win
File metadata and controls
executable file
·85 lines (76 loc) · 2.33 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
# -*- coding: utf-8 -*-
from distutils.core import setup
import glob
import py2exe
import sys
import os
import dabo
import dabo.icons
DATA_FILES = []
plat = sys.platform
print "PLAT", plat
if plat == "darwin":
# OS X
OPTIONS = {"argv_emulation": True, "excludes": ["psycopg2", "MySQLdb", "numpy"],
"iconfile": "springboard.icns"}
elif plat == "win32":
# Windows
import py2exe
OPTIONS = {"excludes": ["psycopg2", "MySQLdb", "numpy", "kinterbasdb"]}
daboDir = os.path.split(dabo.__file__)[0]
# Find the location of the dabo icons:
iconDir = os.path.split(dabo.icons.__file__)[0]
iconSubDirs = []
def getIconSubDir(arg, dirname, fnames):
if os.path.split(dirname)[1] in (".svn", "cards"):
return
icons = glob.glob(os.path.join(dirname, "*.png"))
if icons:
subdir = (os.path.join("resources", dirname[len(arg)+1:]), icons)
iconSubDirs.append(subdir)
os.path.walk(iconDir, getIconSubDir, iconDir)
DATA_FILES.extend(iconSubDirs)
# locales:
localeDir = os.path.join(daboDir, "locale")
locales = []
def getLocales(arg, dirname, fnames):
if os.path.split(dirname)[1] in (".svn", ):
return
mo_files = tuple(glob.glob(os.path.join(dirname, "*.mo")))
if mo_files:
subdir = os.path.join("locale", dirname[len(arg)+1:])
locales.append((subdir, mo_files))
os.path.walk(localeDir, getLocales, localeDir)
DATA_FILES.extend(locales)
# Application files. Include all but .pyc
appDir = os.getcwd()
appFiles = []
def getAppFiles(arg, dirname, fnames):
if os.path.split(dirname)[1] in (".svn", "supplemental", "test"):
return
currnames = glob.glob(os.path.join(dirname, "*"))
filtered = tuple([nm for nm in currnames
if not nm.endswith(".pyc")
and not os.path.isdir(nm)])
if filtered:
subdir = dirname[len(arg)+1:]
appFiles.append((subdir, filtered))
os.path.walk(appDir, getAppFiles, appDir)
DATA_FILES.extend(appFiles)
setup(
# The first three parameters are not required, if at least a
# 'version' is given, then a versioninfo resource is built from
# them and added to the executables.
data_files=DATA_FILES,
version = "1.0",
description = "Dabo Springboard",
name = "Dabo Springboard",
# targets to build
windows = ["main.py"],
#console = ["main.py"],
options={"py2app": OPTIONS,
"py2exe": OPTIONS},
)
# To build, run:
#
# python setup.py py2exe --bundle 1