-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
50 lines (39 loc) · 1.36 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
# -*- coding: utf-8 -*-
'''
Create and organize directory for DnD_Engine.
'''
import sys
import os
import shutil
import openpyxl
ROOT_PATH = os.getcwd()
DOCS_PATH = os.path.join(ROOT_PATH,'docs')
BIN_PATH = os.path.join(ROOT_PATH,'bin')
RESOURCES_PATH = os.path.join(BIN_PATH,'.resources')
GAMES_PATH = os.path.join(ROOT_PATH,'Games')
print('Installing DnD_Engine...')
while True:
try:
print('Creating directories...')
os.mkdir(RESOURCES_PATH)
os.mkdir(GAMES_PATH)
except FileExistsError:
print('Warning! Previous installation detected. Proceed with caution.')
ask = input("Do you want to continue? [Y/n]: ")
if ask.upper() == 'N':
print('Aborting installation.')
break
else:
pass
core_monster_manual = os.path.join(DOCS_PATH,'5E Monster Spreadsheet.xlsx')
reduced_core_monster_manual = os.path.join(RESOURCES_PATH,'5E_mM_.xlsx')
base_mm = openpyxl.load_workbook(core_monster_manual)
base_mm.save(reduced_core_monster_manual)
red_mm = openpyxl.load_workbook(reduced_core_monster_manual)
deleteSheets = ['News & Updates', 'References', 'PC Races']
for sheet in red_mm:
if sheet.title in deleteSheets:
red_mm.remove(sheet)
red_mm.save(reduced_core_monster_manual)
break
print('Done!')