-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·97 lines (86 loc) · 2.56 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
import os
import glob
import sys
from setuptools import setup
def find_data_files(source, target, patterns):
"""Locates the specified data-files and returns the matches
in a data_files compatible format.
source is the root of the source data tree.
Use '' or '.' for current directory.
target is the root of the target data tree.
Use '' or '.' for the distribution directory.
patterns is a sequence of glob-patterns for the
files you want to copy.
From http://www.py2exe.org/index.cgi/data_files
"""
if glob.has_magic(source) or glob.has_magic(target):
raise ValueError("Magic not allowed in source, target")
ret = {}
for pattern in patterns:
pattern = os.path.join(source, pattern)
for filename in glob.glob(pattern):
if os.path.isfile(filename):
targetpath = os.path.join(target, os.path.relpath(filename, source))
path = os.path.dirname(targetpath)
ret.setdefault(path, []).append(filename)
return sorted(ret.items())
# For locating source files
sys.path.append("src")
options = {
"py2exe": {
"bundle_files": 2, # Bundle everything but the Python interpreter
"compressed": True,
"optimize": 2,
"ascii": True,
"packages": ["OpenGL.arrays", "OpenGL.platform"],
"dll_excludes": ["w9xpopen.exe"],
"excludes": [
# Built-in stuff
"_ssl", "BaseHTTPServer", "base64", "bz2", "calendar", "cookielib",
"curses", "distutils", "doctest", "email", "ftplib", "gzip",
"htmlentitydefs", "httplib", "inspect", "locale", "md5", "mimetools",
"mimetypes", "multiprocessing", "pdb", "pickle", "pkgutil", "pydoc",
# Tcl/Tk
"Tkconstants", "Tkinter", "tcl",
# PIL/Tk stuff
"_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTK", "FixTk",
# Unused Pygame features
"pygame.font", "pygame.mixer", "pygame.movie"
],
"dist_dir": "dist/win32"
},
"py2app": {
"app": ["src/main.py"],
"argv_emulation": True,
"dist_dir": "dist/mac"
}
}
extraOpts = {}
if os.name == "nt":
import py2exe
setupRequires = ["py2exe"]
extraOpts["windows"] = [
{
"script": "src/main.py",
"dest_base": "mumei",
"icon_resources": [(0, "assets/pickle.ico")]
}
]
elif sys.platform == "darwin":
setupRequires = ["py2app"]
else:
setupRequires = []
setup(
name="Mumei",
version="0.1",
url="https://github.com/aarmea/mumei",
description="Mumei",
data_files=find_data_files("assets", "assets", [
"*.csv", "*.h", "*.png",
"levels/*",
]),
options=options,
setup_requires=setupRequires,
zipfile=None,
**extraOpts
)