forked from MobProgramming/MobTimer.Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
61 lines (54 loc) · 2.03 KB
/
setup.py
File metadata and controls
61 lines (54 loc) · 2.03 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
def create_windows_exe():
from distutils.core import setup
import py2exe, sys, os
from os import listdir
from os.path import isfile, join
sys.argv.append('py2exe')
# Get theme files and store them in a list
def get_file_paths(folder_name):
file_paths = [f for f in listdir(folder_name) if isfile(join(folder_name, f))]
return ['{}/{}'.format(folder_name, i) for i in file_paths]
[os.remove(x) for x in get_file_paths('dist')]
theme_file_paths = get_file_paths("Themes")
tips_file_paths = get_file_paths("Tips")
image_file_paths = get_file_paths("Images")
setup(windows=[{
"script": 'MobTimer.py',
"icon_resources": [(1, "time-bomb.ico")]
}]
, data_files=[
('', ["MobTimer.cfg", "company-logo.png", "time-bomb.ico"]),
('Themes', theme_file_paths),
('Tips', tips_file_paths),
('Images', image_file_paths)]
, requires=['screeninfo'])
def create_mac_app():
from distutils.core import setup
import py2app, sys, os
from os import listdir
from os.path import isfile, join
sys.argv.append('py2app')
# Get theme files and store them in a list
def get_file_paths(folder_name):
file_paths = [f for f in listdir(folder_name) if isfile(join(folder_name, f))]
return ['{}/{}'.format(folder_name, i) for i in file_paths]
theme_file_paths = get_file_paths("Themes")
tips_file_paths = get_file_paths("Tips")
image_file_paths = get_file_paths("Images")
setup(app=[{
"script": 'MobTimer.py',
"icon_resources": [(1, "time-bomb.ico")]
}]
, data_files=[
('', ["MobTimer.cfg", "company-logo.png", "time-bomb.ico"]),
('Themes', theme_file_paths),
('Tips', tips_file_paths),
('Images', image_file_paths)]
, requires=['py2app']
)
import platform
import os
if platform.system() == 'Darwin':
create_mac_app()
else:
create_windows_exe()