-
Notifications
You must be signed in to change notification settings - Fork 0
/
preparePIP.py
50 lines (37 loc) · 1.41 KB
/
preparePIP.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
# -*- coding: utf-8 -*-
"""
Spyder Editor
Script to copy all dependencies into the DMCGui folder to prepare for pip
installation
"""
import os, shutil
def copytree(src, dst, symlinks=False, ignore=None, remove=None):
if remove is None:
remove = []
for item in os.listdir(src):
if os.path.split(item)[-1] in remove:
continue
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
shutil.copytree(s, d, symlinks, ignore)
print('Copying folder {} to {}'.format(s,d))
else:
shutil.copy2(s, d)
print('Copying file {} to {}'.format(s,d))
delCommand = 'del'
local = os.path.dirname(__file__)
targetDir = os.path.join(local,'DMCGui','src')
if not os.path.exists(targetDir):
os.system("mkdir {}".format(targetDir))
# If the build folder exists also delete the main folder
if os.path.exists(os.path.join(targetDir,'build')):
shutil.rmtree(os.path.join(targetDir,'build'))
shutil.rmtree(os.path.join(targetDir,'main'))
# Do not include the installer or sign folders
removeList = ['installer','sign']
copytree(os.path.join(local,'src'),targetDir,remove=removeList)
# Remove secret json file (Currently not present)
secretFile = os.path.join(targetDir,'build','settings','secret.json')
if os.path.exists(secretFile):
os.remove(os.path.join(targetDir,'build','settings','secret.json'))