-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
53 lines (43 loc) · 1.67 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
from distutils.core import setup
import py2exe
import os
import sys
sys.argv.append('py2exe')
# The filename of the script you use to start your program.
target_file = 'pyro.py'
# The root directory containing your assets, libraries, etc.
assets_dir = '.\\'
# Filetypes not to be included in the above.
excluded_file_types = ['py','pyc','project','pydevproject']
def get_data_files(base_dir, target_dir, list=[]):
"""
" * get_data_files
" * base_dir: The full path to the current working directory.
" * target_dir: The directory of assets to include.
" * list: Current list of assets. Used for recursion.
" *
" * returns: A list of relative and full path pairs. This is
" * specified by distutils.
"""
for file in os.listdir(base_dir + target_dir):
full_path = base_dir + target_dir + file
if os.path.isdir(full_path):
get_data_files(base_dir, target_dir + file + '\\', list)
elif os.path.isfile(full_path):
if (len(file.split('.')) == 2 and file.split('.')[1] not in excluded_file_types):
list.append((target_dir, [full_path]))
return list
# The directory of assets to include.
my_files = get_data_files(sys.path[0] + '\\', assets_dir)
# Build a dictionary of the options we want.
opts = { 'py2exe': {
'ascii':'True',
'excludes':['_ssl','_hashlib'],
'includes' : ['anydbm', 'dbhash'],
'bundle_files':'1',
'compressed':'True'}}
# Run the setup utility.
setup(console=[target_file],
data_files=my_files,
zipfile=None,
options=opts)