
make_distrib.py
By:
dpasca on
May 7th, 2012 | syntax:
Python | size: 1.56 KB | hits: 38 | expires: Never
#!/usr/bin/env python
import os, shutil, glob
import datetime
#=======================================================
def copyDir( destPath, dirName, pattern="*" ) :
destPath2 = destPath
if False == os.path.exists( destPath2 ) :
os.mkdir( destPath2 )
for f in glob.glob( dirName + "/" + pattern ):
shutil.copy( f, destPath2 )
return
#=======================================================
class TempDir:
def __init__(self,name) :
self.name = name
if False == os.path.exists( name ) :
os.mkdir( name )
def __del__(self) :
shutil.rmtree( self.name )
#=======================================================
now = datetime.datetime.now()
destPath = "FinalFreeway2R_PressKit"
destPathDir = TempDir( destPath )
copyDir( destPath, "source", "*.png" )
copyDir( destPath, "source", "*.jpg" )
copyDir( destPath, "source", "*.txt" )
copyDir( destPath, "../app_store/sshots", "*960*" )
docBaseName = "FinalFreeway2R_PressRel"
tmpDocsDir = TempDir( 'tmpdocs' )
os.system(\
'python rst2latex.py source/' + docBaseName + '.txt ' +\
'tmpdocs/' + docBaseName + '.tex ' + \
'--latex-preamble="\usepackage{geometry} \geometry{hmargin={2.5cm,2.5cm},height=10in} \usepackage{parskip}" --font-encoding=""')
os.system(\
'pdflatex -aux-directory="tmpdocs" -include-directory="source" -output-directory="' + destPath + '" ' +\
'tmpdocs/' + docBaseName + '.tex' )
archiveName = destPath # + "_" + now.strftime("%Y.%m.%d")
#now.strftime("%Y.%m.%d_%H.%M")
shutil.make_archive( archiveName, "zip", ".", destPath )