forked from salabim/salabim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
37 lines (31 loc) · 956 Bytes
/
install.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
import numpy
import os
import shutil
import glob
import sys
Pythonista = (sys.platform == 'ios')
site_packages = os.sep + 'site-packages' + os.sep
if Pythonista:
documents = '/Documents'
sp = os.getcwd().split(documents)
if len(sp) != 2:
print('unable to install')
exit()
path = sp[0] + documents + '/site-packages/salabim'
else:
path = numpy.__file__.split(site_packages)[0] + site_packages + 'salabim'
if not os.path.isdir(path):
os.makedirs(path)
files = glob.iglob("*.*")
ok = False
for file in files:
if (file in ('salabim.py', 'changelog.txt', 'license.txt')) or (file.endswith('.ttf')):
if file == 'salabim.py':
ok = True
shutil.copy(file, path + os.sep + file)
if ok:
with open(path + os.sep + '__init__.py', 'w') as initfile:
initfile.write('from .salabim import *\n')
print('salabim succesfully installed')
else:
print('could not find salabim.py')