3 from subprocess
import PIPE
, Popen
as P
5 from sys
import argv
, exit
8 # Get version number. If not specified, assume we're just doing a snapshot.
10 print "No version specified. Using today's date as a snapshot name."
11 p
= P("jben/linux_scripts/mydate", shell
=True, stdout
=PIPE
)
13 version
= p
.stdout
.readline().strip()
17 packageName
= baseName
+ "-" + version
18 sourcePackageName
= packageName
+ "-source"
20 print "Packaging " + baseName
+ " version " + version
+ "..."
22 # Define the files to save
23 linuxfiles
= " jben/src/*.xpm jben/linux_scripts"
24 winfiles
= " jben/src/jben.ico jben/src/jben.rc"
25 otherfiles
= " jben/*.txt jben/dicts/* jben/doc/*.xml jben/doc/jben.dia" \
26 + " jben/license jben/old_files jben/sods/README.txt" \
27 + " jben/src/jben_icon.xcf jben/src/installer.nsi"
28 kpenginefiles
= " jben/src/kpengine"
29 sourcefiles
= "jben/src/Makefile jben/src/*.cpp jben/src/*.h " + otherfiles
+ kpenginefiles
+ linuxfiles
+ winfiles
31 # Make the .tar.bz2 archive
32 p
= P("tar -cjf " + sourcePackageName
+ ".tar.bz2 " + sourcefiles
, \
34 (garbage
,result
)=waitpid(p
.pid
,0)
36 print 'Error: could not create source archive "' + sourcePackageName
+ '.tar.bz2".'
38 print 'Source archive "' + sourcePackageName
+ '.tar.bz2" created.'
40 # Make the .zip archive
41 p
= P("zip -rq " + sourcePackageName
+ ".zip " + sourcefiles
, \
43 (garbage
,result
)=waitpid(p
.pid
,0)
45 print 'Error: could not create source archive "' + sourcePackageName
+ '.zip".'
47 print 'Source archive "' + sourcePackageName
+ '.zip" created.'
48 print 'Finished creating all archives for ' + packageName
+ '!'
50 archiveDir
= 'jben/archives/' + version
51 print 'Creating directory "' + archiveDir
+ '...'
52 command
= 'mkdir -p ' + archiveDir
53 p
= P(command
, shell
=True)
54 (garbage
,result
)=waitpid(p
.pid
,0)
56 print 'Error: could not create archive directory.'
59 print 'Moving files...'
60 command
= 'mv ' + packageName
+ '* ' + archiveDir
61 p
= P(command
, shell
=True)
62 (garbage
,result
)=waitpid(p
.pid
,0)
64 print 'Archival complete.'