forked from shanet/Cryptully
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.py
executable file
·68 lines (51 loc) · 1.76 KB
/
make.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /usr/bin/env python
import os
import shutil
import subprocess
import sys
def clean():
deleteDirectory('build')
deleteDirectory('dist')
deleteDirectory('deb_dist')
deleteDirectory('Cryptully.egg-info')
deleteFile('logdict2.7.4.final.0-1.log')
def deleteDirectory(path):
try:
shutil.rmtree(path)
except OSError as ose:
# Ignore 'no such file or directory' errors
if ose.errno != 2:
print ose
def deleteFile(path):
try:
os.unlink(path)
except OSError as ose:
if ose.errno != 2:
print ose
arg = sys.argv[1] if len(sys.argv) >= 2 else None
if arg == 'dist':
if len(sys.argv) == 3:
pyinstallerPath = sys.argv[2]
else:
pyinstallerPath = raw_input("Path to pyinstaller: ")
clean()
subprocess.call(['python', os.path.join(pyinstallerPath, 'pyinstaller.py'), 'cryptully.spec'])
elif arg == 'deb':
print "Ensure you have the python-stdeb package installed!"
subprocess.call(['python', 'setup.py', '--command-packages=stdeb.command', 'bdist_deb'])
elif arg == 'rpm':
subprocss.call(['python', 'setup.py', 'bdist_rpm', '--post-install=rpm/postinstall', '--pre-uninstall=rpm/preuninstall'])
elif arg == 'install':
subprocess.call(['python', 'setup.py', 'install'])
elif arg == 'source':
subprocess.call(['python', 'setup.py', 'sdist'])
elif arg == 'run':
subprocess.call(['python', os.path.join('cryptully', 'cryptully.py')])
elif arg == 'test':
# Carry the exit code from the tests
exitCode = subprocess.call(['python', os.path.join('cryptully', 'test_cryptully.py')])
sys.exit(exitCode)
elif arg == 'clean':
clean()
else:
print "Invalid option\nPossible options: dist, deb, rpm, install, source, run, test, clean"