forked from esitarski/CrossMgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeRelease.py
executable file
·112 lines (90 loc) · 3.27 KB
/
MakeRelease.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python
#-----------------------------------------------------------------------
# Based on the instructions found in:
# http://wiki.wxpython.org/CreatingStandaloneExecutables
#
from __future__ import print_function
import os
import shutil
import sys
import tarfile
import py_compile
import subprocess
import platform
if platform.system() != 'Linux':
print( 'This script only runs on Linux' )
sys.exit()
distPath = 'dist'
#-----------------------------------------------------------------------
# Compile the help files
#
from helptxt.compile import CompileHelp
CompileHelp( 'helptxt' )
#-----------------------------------------------------------------------
# Make the distribution folder.
#
if not os.path.exists(distPath):
os.makedirs( distPath )
#-----------------------------------------------------------------------
# Compile all the python files.
#
for f in os.listdir( '.' ):
if not (f.endswith( '.py' ) or f.endswith( '.pyw' )):
continue
print( 'compiling:', f, '...' )
py_compile.compile( f )
'''------------------------------------------------------------------'''
'''------------------------------------------------------------------'''
buildPath = 'CrossMgrBuild'
#-----------------------------------------------------------------------
# Clean up the build folder.
#
shutil.rmtree( buildPath )
#-----------------------------------------------------------------------
# Create the release.
#
p = subprocess.Popen( ['bash', 'pyinstaller.sh'], stdout=subprocess.PIPE )
ret = p.communicate()
releasePath = 'CrossMgrBuild/dist/CrossMgr'
import Version
tarName = Version.AppVerName.replace(' ', '_') + '_i386.tar.gz'
tf = tarfile.open( os.path.join(distPath, tarName), 'w:gz' )
for f in os.listdir( releasePath ):
tf.add( os.path.join(releasePath, f), os.path.join('CrossMgr',f) )
for dir in ['images', 'htmldoc', 'html']:
targetDir = os.path.join( 'CrossMgr', dir )
for f in os.listdir( dir ):
tf.add( os.path.join(dir,f), os.path.join(targetDir, f) )
targetDir = os.path.join( 'CrossMgr', 'doc' )
tf.add( 'CrossMgrTutorial.doc', os.path.join(targetDir,'CrossMgrTutorial.doc') )
tf.close()
sys.exit()
'''------------------------------------------------------------------'''
#-----------------------------------------------------------------------
from bbfreeze import Freezer
f = Freezer(releasePath)
f.addScript("CrossMgr.pyw")
f() # starts the freezing process
#-----------------------------------------------------------------------
# Remove any hard-coded library dependencies
#
for f in os.listdir( releasePath ):
if not f.endswith( '.so' ):
continue
fname = os.path.join(releasePath, f)
p = subprocess.Popen( ['chrpath', '-r', fname], stdout=subprocess.PIPE )
ret = p.communicate()
print( f, ret )
import Version
tarName = Version.AppVerName.replace(' ', '_') + '_i386.tar.gz'
tf = tarfile.open( os.path.join(distPath, tarName), 'w:gz' )
for f in os.listdir( releasePath ):
tf.add( os.path.join(releasePath, f), os.path.join('CrossMgr',f) )
for dir in ['images', 'htmldoc', 'html']:
targetDir = os.path.join( 'CrossMgr', dir )
for f in os.listdir( dir ):
tf.add( os.path.join(dir,f), os.path.join(targetDir, f) )
targetDir = os.path.join( 'CrossMgr', 'doc' )
tf.add( 'CrossMgrTutorial.doc', os.path.join(targetDir,'CrossMgrTutorial.doc') )
tf.close()
sys.exit()