Skip to content

Commit bd38a9d

Browse files
author
Pipeline
committed
F - Update app to deploy application to windows
1 parent 7942b0b commit bd38a9d

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

BuildMobTimer.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import subprocess
2+
from shutil import copy, copytree, rmtree
3+
4+
rmtree('./dist')
5+
py_installer_command = 'pyinstaller --clean --onefile --windowed MobTimer.spec'.split(" ")
6+
7+
# Run py installer
8+
subprocess.run(py_installer_command)
9+
10+
# Copy files MobTimer.spec and TimeBomb icon into dist/ directory
11+
12+
13+
copy('./MobTimer.cfg', './dist/MobTimer.cfg')
14+
copy('./time-bomb.ico', './dist/time-bomb.ico')
15+
copytree('./Themes', './dist/Themes')
16+
copytree('./Tips', './dist/Tips')
17+
copytree('./Images', './dist/Images')

Infrastructure/TipsManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, seed=None, root_directory=sys.argv[0]):
1212
random.seed(seed)
1313

1414
def go_up_dir(self, root_directory):
15-
return "/".join(root_directory.split('/')[:-1])
15+
return "/".join(root_directory.split('\\')[:-1])
1616

1717
def get_random_tip(self):
1818
tips_folder = self.root_directory + "/Tips"

tests/Infrastructure/TipsManager/test_TipsManager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ def test_random_tip_from_file(self):
1111
seed = 0
1212

1313
dirname = os.path.dirname(__file__)
14-
path = self.go_two_dirs_up(dirname) + "/Tips"
14+
path = self.go_two_dirs_up(dirname) + "\\Tips"
1515
tips_manager = TipsManager(seed, path)
1616
result = tips_manager.get_random_tip()
1717
self.assertEqual(result, 'TestTips2.txt: Words\n')
1818

1919
def go_two_dirs_up(self, dirname):
20-
return "/".join(dirname.split('\\')[:-2])
20+
return "\\".join(dirname.split('\\')[:-2])
2121

2222
def test_random_tip_from_file_second(self):
2323
seed = 1
2424
dirname = os.path.dirname(__file__)
25-
path = self.go_two_dirs_up(dirname) + "/Tips"
25+
path = self.go_two_dirs_up(dirname) + "\\Tips"
2626
tips_manager = TipsManager(seed, path)
2727
result = tips_manager.get_random_tip()
2828
self.assertEqual(result, 'TestTips.txt: Customer collaboration over contract negotiation\n')

0 commit comments

Comments
 (0)