Re-added basic dictionaries to Linux source distribution.
[jben.git] / linux_scripts / package_jben
blobb6c97f422a15d0d97610241fae58e6652a55b1a9
1 #!/usr/bin/env python
3 from subprocess import PIPE, Popen as P
4 from os import waitpid
5 from sys import argv, exit
7 baseName = "jben"
8 # Get version number. If not specified, assume we're just doing a snapshot.
9 if(len(argv)<2):
10 print "No version specified. Using today's date as a snapshot name."
11 p = P("jben/linux_scripts/mydate", shell=True, stdout=PIPE)
12 waitpid(p.pid,0)
13 version = p.stdout.readline().strip()
14 else:
15 version = argv[1]
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, \
33 shell=True)
34 (garbage,result)=waitpid(p.pid,0)
35 if(result!=0):
36 print 'Error: could not create source archive "' + sourcePackageName + '.tar.bz2".'
37 exit(-1)
38 print 'Source archive "' + sourcePackageName + '.tar.bz2" created.'
40 # Make the .zip archive
41 p = P("zip -rq " + sourcePackageName + ".zip " + sourcefiles, \
42 shell=True)
43 (garbage,result)=waitpid(p.pid,0)
44 if(result!=0):
45 print 'Error: could not create source archive "' + sourcePackageName + '.zip".'
46 exit(-1)
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)
55 if(result!=0):
56 print 'Error: could not create archive directory.'
57 exit(-1)
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.'