def main(): if len(sys.argv) < 2: print 'Usage: %s [version] [--install] [--local|username password]' % sys.argv[0] print 'Where [version] is the branch you want to checkout' print 'and username and password are for your eduforge account' print 'Eg. %s 0.7 --local' % sys.argv[0] else: version = sys.argv[1] branch = 'http://exe.cfdl.auckland.ac.nz/svn/exe/branches/%s' % version origDir = Path(sys.argv[0]).abspath().dirname() tmp = TempDirPath() os.chdir(tmp) os.system('svn export %s exe' % branch) (origDir/'../../exe/webui/firefox').copytree(tmp/'exe/exe/webui/firefox') os.chdir(tmp/'exe') tarball = Path('../exe-%s-source.tgz' % version).abspath() os.system('tar czf %s *' % tarball) os.chdir(tmp) if '--local' not in sys.argv: try: from paramiko import Transport except ImportError: print 'To upload you need to install paramiko python library from:' print 'http://www.lag.net/paramiko' sys.exit(2) from socket import socket, gethostbyname s = socket() s.connect((gethostbyname('shell.eduforge.org'), 22)) t = Transport(s) t.connect() t.auth_password(sys.argv[-2], sys.argv[-1]) f = t.open_sftp_client() f.chdir('/home/pub/exe') f.put(tarball.encode('utf8'), tarball.basename().encode('utf8')) if os.getuid() == 0: tarball.copyfile('/usr/portage/distfiles/' + tarball.basename()) os.chdir(tmp/'exe/installs/gentoo') newEbuildFilename = Path('exe-%s.ebuild' % version).abspath() if not newEbuildFilename.exists(): Path('exe-0.7.ebuild').copy(newEbuildFilename) if os.getuid() == 0: ebuildDir = Path('/usr/local/portage/dev-python/exe') if ebuildDir.exists(): ebuildDir.rmtree() ebuildDir.makedirs() os.chdir(ebuildDir) newEbuildFilename.copy(ebuildDir) filesDir = ebuildDir/'files' filesDir.makedirs() Path(tmp/'exe/installs/gentoo/all-config.patch').copy(filesDir) if '--local' not in sys.argv: oldTarball = Path('/usr/portage/distfiles/')/tarball.basename() if oldTarball.exists(): oldTarball.remove() os.environ['GENTOO_MIRRORS']='' os.system('ebuild %s fetch' % newEbuildFilename.basename()) os.system('ebuild %s manifest' % newEbuildFilename.basename()) os.system('ebuild %s digest' % newEbuildFilename.basename()) if '--install' in sys.argv: os.system('ebuild %s install' % newEbuildFilename.basename())
def uploadFile(self, filePath): """ Store the upload files in the package Needs to be in a package to work. """ if self.type == "descartes" and not filePath.endswith(".jar"): if filePath.find(",") == -1: global SCENE_NUM SCENE_NUM = 1 else: SCENE_NUM = int(filePath[:filePath.find(",")]) if self.type == "descartes" and (filePath.endswith(".htm") or filePath.endswith(".html")): global url url = filePath self.appletCode = self.getAppletcodeDescartes(filePath) # none scene was found: if self.appletCode == '': return None else: log.debug(u"uploadFile " + unicode(filePath)) resourceFile = Path(filePath) assert self.parentNode, _('file %s has no parentNode') % self.id assert self.parentNode.package, \ _('iDevice %s has no package') % self.parentNode.id if resourceFile.isfile(): self.message = "" Resource(self, resourceFile) if self.type == "geogebra": self.appletCode = self.getAppletcodeGeogebra( resourceFile.basename().replace(' ', '_').replace( ')', '').replace('(', '')) if self.type == "jclic": self.appletCode = self.getAppletcodeJClic( resourceFile.basename().replace(' ', '_').replace( ')', '').replace('(', '')) if self.type == "scratch": self.appletCode = self.getAppletcodeScratch( resourceFile.basename().replace(' ', '_').replace( ')', '').replace('(', '')) if self.type == "descartes": self.appletCode = self.getAppletcodeDescartes( resourceFile.basename()) ## next code should be used to load in the editor the HTML code of the html file: # if self.type == "other": # if filePath.endswith(".html") or filePath.endswith(".htm"): # content = open(filePath, 'r') # str = content.read() # self.appletCode = str # content.close() # else: # log.error('File %s is not a HTML file' % resourceFile) else: log.error('File %s is not a file' % resourceFile)
def exportSinglePage(self, client, filename, webDir, stylesDir): """ Export 'client' to a single web page, 'webDir' is just read from config.webDir 'stylesDir' is where to copy the style sheet information from """ imagesDir = webDir.joinpath('images') scriptsDir = webDir.joinpath('scripts') templatesDir = webDir.joinpath('templates') filename = Path(filename) if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: try: filename.rmtree() filename.mkdir() except Exception, e: client.alert(_('There was an error in the export:\n%s') % str(e)) return
def exportSinglePage(self, client, filename, webDir, stylesDir, printFlag): """ Export 'client' to a single web page, 'webDir' is just read from config.webDir 'stylesDir' is where to copy the style sheet information from 'printFlag' indicates whether or not this is for print (and whatever else that might mean) """ try: imagesDir = webDir.joinpath('images') scriptsDir = webDir.joinpath('scripts') templatesDir = webDir.joinpath('templates') filename = Path(filename) if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: client.alert(_(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.') % filename) return singlePageExport = SinglePageExport(stylesDir, filename, imagesDir, scriptsDir, templatesDir) singlePageExport.export(self.package, printFlag) except Exception, e: client.alert(_('SAVE FAILED!\n%s' % str(e))) raise
def exportWebSite(self, client, filename, stylesDir): """ Export 'client' to a web site, 'webDir' is just read from config.webDir 'stylesDir' is where to copy the style sheet information from """ try: filename = Path(filename) if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: client.alert(_(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.') % filename) return websiteExport = WebsiteExport(self.config, stylesDir, filename) websiteExport.export(self.package) except Exception, e: client.alert(_('EXPORT FAILED!\n%s') % str(e)) raise
def exportIpod(self, client, filename): """ Export 'client' to an iPod Notes folder tree 'webDir' is just read from config.webDir """ try: # filename is a directory where we will export the notes to # We assume that the user knows what they are doing # and don't check if the directory is already full or not # and we just overwrite what's already there filename = Path(filename) # Append the package name to the folder path if necessary if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: client.alert(_(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.') % filename) return # Now do the export ipodExport = IpodExport(self.config, filename) ipodExport.export(self.package) except Exception, e: client.alert(_('EXPORT FAILED!\n%s') % str(e)) raise
def exportWebSite(self, client, filename, webDir, stylesDir): """ Export 'client' to a web site, 'webDir' is just read from config.webDir 'stylesDir' is where to copy the style sheet information from """ imagesDir = webDir.joinpath('images') scriptsDir = webDir.joinpath('scripts') templatesDir = webDir.joinpath('templates') filename = Path(filename) if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: filename.rmtree() filename.mkdir() websiteExport = WebsiteExport(stylesDir, filename, imagesDir, scriptsDir, templatesDir) websiteExport.export(self.package) self._startFile(filename)
def exportIpod(self, client, filename): """ Export 'client' to an iPod Notes folder tree 'webDir' is just read from config.webDir """ try: # filename is a directory where we will export the notes to # We assume that the user knows what they are doing # and don't check if the directory is already full or not # and we just overwrite what's already there filename = Path(filename) # Append the package name to the folder path if necessary if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert( _(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: " + "Filename %s is a file, cannot replace it" % filename) return else: client.alert( _(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.' ) % filename) return # Now do the export ipodExport = IpodExport(self.config, filename) ipodExport.export(self.package) except Exception, e: client.alert(_('EXPORT FAILED!\n%s') % str(e)) raise
def exportIpod(self, client, filename): """ Export 'client' to an iPod Notes folder tree 'webDir' is just read from config.webDir """ try: filename = Path(filename) if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: client.alert(_(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.') % filename) return ipodExport = IpodExport(self.config, filename) ipodExport.export(self.package) except Exception, e: client.alert(_('EXPORT FAILED!\n%s') % str(e)) raise
def uploadFile(self, filePath): """ Store the upload files in the package Needs to be in a package to work. """ if self.type == "descartes" and not filePath.endswith(".jar"): if filePath.find(",") == -1: global SCENE_NUM SCENE_NUM = 1 else: SCENE_NUM = int(filePath[:filePath.find(",")]) if self.type == "descartes" and (filePath.endswith(".htm") or filePath.endswith(".html")): global url url = filePath self.appletCode = self.getAppletcodeDescartes(filePath) # none scene was found: if self.appletCode == '': return None else: log.debug(u"uploadFile "+unicode(filePath)) resourceFile = Path(filePath) assert self.parentNode, _('file %s has no parentNode') % self.id assert self.parentNode.package, \ _('iDevice %s has no package') % self.parentNode.id if resourceFile.isfile(): self.message = "" Resource(self, resourceFile) if self.type == "geogebra": self.appletCode = self.getAppletcodeGeogebra(resourceFile.basename().replace(' ','_').replace(')','').replace('(','')) if self.type == "jclic": self.appletCode = self.getAppletcodeJClic(resourceFile.basename().replace(' ','_').replace(')','').replace('(','')) if self.type == "scratch": self.appletCode = self.getAppletcodeScratch(resourceFile.basename().replace(' ','_').replace(')','').replace('(','')) if self.type == "descartes": self.appletCode = self.getAppletcodeDescartes(resourceFile.basename()) ## next code should be used to load in the editor the HTML code of the html file: # if self.type == "other": # if filePath.endswith(".html") or filePath.endswith(".htm"): # content = open(filePath, 'r') # str = content.read() # self.appletCode = str # content.close() # else: # log.error('File %s is not a HTML file' % resourceFile) else: log.error('File %s is not a file' % resourceFile)
def main(): usage = "usage: %prog [options]" parser = OptionParser(usage) parser.add_option("-n", "--new", action="store_true", dest="preserve_new", default=False, help="create new .mo files for languages that are not yet in SVN") (options, args) = parser.parse_args() # Move to the right dir curdir = Path('.').abspath() if curdir.basename() == 'exe': if 'locale' in [p.relpath() for p in curdir.dirs()]: (curdir/'..').chdir() elif curdir.basename() == 'locale': (curdir/'..'/'..').chdir() print 'Running from: %s' % Path('.').abspath() # make sure any old build is not around to be scanned for strings shutil.rmtree('build', ignore_errors=True) shutil.rmtree('debian/python2.4-exe', ignore_errors=True) shutil.rmtree('debian/python2.5-exe', ignore_errors=True) shutil.rmtree('debian/python-exe', ignore_errors=True) try: os.remove('debian') except OSError: pass # Fill out the options option = {} option['forceEnglish'] = 0 option['mo'] = 0 option['po'] = 0 option['verbose'] = 1 option['domain'] = None option['moTarget'] = Path('exe/locale').abspath() option['domain'] = 'exe' if option['verbose']: print "Application domain used is: '%s'" % option['domain'] print 'Generating file list: app.fil' # Generate the list of files to use generateAppFil() # Make the .po files try: makePO(Path('.'),option['domain'],option['verbose']) except IOError, e: printUsage(e[1] + '\n You must write a file app.fil that contains the list of all files to parse.')
def uploadFile(self, filePath): """ Store the upload files in the package Needs to be in a package to work. """ if self.type == "descartes" and not filePath.endswith(".jar"): if filePath.find(",") == -1: global SCENE_NUM SCENE_NUM = 1 else: SCENE_NUM = int(filePath[:filePath.find(",")]) if (filePath.endswith(".htm") or filePath.endswith(".html")): global url url = filePath self.appletCode = self.getAppletcodeDescartes(filePath) # none scene was found: if self.appletCode == '': return None else: log.debug(u"uploadFile "+unicode(filePath)) resourceFile = Path(filePath) assert self.parentNode, _('file %s has no parentNode') % self.id assert self.parentNode.package, \ _('iDevice %s has no package') % self.parentNode.id if resourceFile.isfile(): self.message = "" Resource(self, resourceFile) if self.type == "geogebra": self.appletCode = self.getAppletcodeGeogebra(resourceFile.basename()) if self.type == "jclic": self.appletCode = self.getAppletcodeJClic(resourceFile.basename()) if self.type == "scratch": self.appletCode = self.getAppletcodeScratch(resourceFile.basename()) if self.type == "descartes": self.appletCode = self.getAppletcodeDescartes(resourceFile.basename()) else: log.error('File %s is not a file' % resourceFile)
def uploadFile(self, filePath): """ Store the upload files in the package Needs to be in a package to work. """ log.debug(u"uploadFile "+unicode(filePath)) resourceFile = Path(filePath) assert(self.parentNode, _('file %s has no parentNode') % self.id) assert(self.parentNode.package, _('iDevice %s has no package') % self.parentNode.id) if resourceFile.isfile(): self.message = "" Resource(self, resourceFile) if self.type == "geogebra": self.appletCode = self.getAppletcode(resourceFile.basename()) else: log.error('File %s is not a file' % resourceFile)
def exportSinglePage(self, client, filename, webDir, stylesDir, \ printFlag): """ Export 'client' to a single web page, 'webDir' is just read from config.webDir 'stylesDir' is where to copy the style sheet information from 'printFlag' indicates whether or not this is for print (and whatever else that might mean) """ try: imagesDir = webDir.joinpath('images') scriptsDir = webDir.joinpath('scripts') templatesDir = webDir.joinpath('templates') # filename is a directory where we will export the website to # We assume that the user knows what they are doing # and don't check if the directory is already full or not # and we just overwrite what's already there filename = Path(filename) # Append the package name to the folder path if necessary if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert( _(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: " + "Filename %s is a file, cannot replace it" % filename) return else: client.alert( _(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.' ) % filename) return # Now do the export singlePageExport = SinglePageExport(stylesDir, filename, \ imagesDir, scriptsDir, templatesDir) singlePageExport.export(self.package, printFlag) except Exception, e: client.alert(_('SAVE FAILED!\n%s' % str(e))) raise
def doImportTemplate(self, filename): """ Imports an template from a ELT file Checks that it is a valid template file, that the directory does not exist (prevent overwriting) """ log.debug("Import template from %s" % filename) filename = Path(filename) baseFile = filename.basename() absoluteTargetDir = self.config.templatesDir / baseFile try: ZipFile(filename, 'r') except IOError: raise ImportTemplateError('Can not create dom object') if os.path.exists(absoluteTargetDir): template = Template(absoluteTargetDir) raise ImportTemplateExistsError(template, absoluteTargetDir, u'Template already exists') else: filename.copyfile(absoluteTargetDir) template = Template(absoluteTargetDir) if template.isValid(): if not self.config.templateStore.addTemplate(template): absoluteTargetDir.remove() raise ImportTemplateExistsError( template, absoluteTargetDir, u'The template name already exists') else: absoluteTargetDir.remove() raise ImportTemplateExistsError(template, absoluteTargetDir, u'Incorrect template format') self.action = ""
def main(): if len(sys.argv) < 2: print 'Usage: %s [version]' % sys.argv[0] print 'Where [version] is the branch you want to checkout' print 'Eg. %s 0.7' % sys.argv[0] else: version = sys.argv[1] branch = 'http://exe.cfdl.auckland.ac.nz/svn/exe/branches/%s' % version origDir = Path(sys.argv[0]).abspath().dirname() tmp = TempDirPath() os.chdir(tmp) os.system('svn export %s exe' % branch) (origDir/'../../exe/webui/firefox').copytree(tmp/'exe/exe/webui/firefox') os.chdir(tmp/'exe') tarball = Path('../exe-%s-source.tgz' % version).abspath() os.system('tar czf %s *' % tarball) os.chdir(tmp) if '--local' not in sys.argv: open('sftpbatch.tmp', 'w').write( 'cd /home/pub/exe\n' 'put %s\n' % tarball) os.system('sftp -b sftpbatch.tmp [email protected]') if os.getuid() == 0: tarball.copyfile('/usr/portage/distfiles/' + tarball.basename()) os.chdir(tmp/'exe/installs/gentoo') newEbuildFilename = Path('exe-%s.ebuild' % version).abspath() if not newEbuildFilename.exists(): Path('exe-0.7.ebuild').copy(newEbuildFilename) if os.getuid() == 0: ebuildDir = Path('/usr/local/portage/dev-python/exe') if ebuildDir.exists(): ebuildDir.rmtree() ebuildDir.makedirs() os.chdir(ebuildDir) newEbuildFilename.copy(ebuildDir) filesDir = ebuildDir/'files' filesDir.makedirs() Path(tmp/'exe/installs/gentoo/all-config.patch').copy(filesDir) if '--local' not in sys.argv: oldTarball = Path('/usr/portage/distfiles/')/tarball.basename() if oldTarball.exists(): oldTarball.remove() os.environ['GENTOO_MIRRORS']='' os.system('ebuild %s fetch' % newEbuildFilename.basename()) os.system('ebuild %s manifest' % newEbuildFilename.basename()) os.system('ebuild %s digest' % newEbuildFilename.basename()) if '--install' in sys.argv: os.system('ebuild %s install' % newEbuildFilename.basename())
def exportSinglePage(self, client, filename, webDir, stylesDir, \ printFlag): """ Export 'client' to a single web page, 'webDir' is just read from config.webDir 'stylesDir' is where to copy the style sheet information from 'printFlag' indicates whether or not this is for print (and whatever else that might mean) """ try: imagesDir = webDir.joinpath('images') scriptsDir = webDir.joinpath('scripts') templatesDir = webDir.joinpath('templates') # filename is a directory where we will export the website to # We assume that the user knows what they are doing # and don't check if the directory is already full or not # and we just overwrite what's already there filename = Path(filename) # Append the package name to the folder path if necessary if filename.basename() != self.package.name: filename /= self.package.name if not filename.exists(): filename.makedirs() elif not filename.isdir(): client.alert(_(u'Filename %s is a file, cannot replace it') % filename) log.error("Couldn't export web page: "+ "Filename %s is a file, cannot replace it" % filename) return else: client.alert(_(u'Folder name %s already exists. ' 'Please choose another one or delete existing one then try again.') % filename) return # Now do the export singlePageExport = SinglePageExport(stylesDir, filename, \ imagesDir, scriptsDir, templatesDir) singlePageExport.export(self.package, printFlag) except Exception, e: client.alert(_('SAVE FAILED!\n%s' % str(e))) raise
def main(): if len(sys.argv) < 2: print 'Usage: %s [version] [--install] [--local|username password]' % sys.argv[0] print 'Where [version] is the branch you want to checkout' print 'and username and password are for your eduforge account' print 'Eg. %s 0.7 --local' % sys.argv[0] else: version = sys.argv[1] # Calc the svn branch name branch = 'http://exe.cfdl.auckland.ac.nz/svn/exe/branches/%s' % version # Get the original exe dir origDir = Path(sys.argv[0]).abspath().dirname() # Make the temp dir tmp = TempDirPath() os.chdir(tmp) # Do the export os.system('svn export %s exe' % branch) # Copy firefox accross (origDir/'../../exe/webui/firefox').copytree(tmp/'exe/exe/webui/firefox') # Now make the tarball os.chdir(tmp/'exe') tarball = Path('../exe-%s-source.tgz' % version).abspath() os.system('tar czf %s *' % tarball) os.chdir(tmp) # Upload it if '--local' not in sys.argv: # Connect with sftp try: from paramiko import Transport except ImportError: print 'To upload you need to install paramiko python library from:' print 'http://www.lag.net/paramiko' sys.exit(2) from socket import socket, gethostbyname s = socket() s.connect((gethostbyname('shell.eduforge.org'), 22)) t = Transport(s) t.connect() t.auth_password(sys.argv[-2], sys.argv[-1]) f = t.open_sftp_client() # See that the directory structure looks good f.chdir('/home/pub/exe') f.put(tarball.encode('utf8'), tarball.basename().encode('utf8')) # If we're root, copy the tarball to the portage cache dir to save # downloading it when emerging (for me anyway) if os.getuid() == 0: tarball.copyfile('/usr/portage/distfiles/' + tarball.basename()) # Copy the ebuild file os.chdir(tmp/'exe/installs/gentoo') newEbuildFilename = Path('exe-%s.ebuild' % version).abspath() if not newEbuildFilename.exists(): Path('exe-0.7.ebuild').copy(newEbuildFilename) # If we're root, rebuild the digests and remake the install if os.getuid() == 0: ebuildDir = Path('/usr/local/portage/dev-python/exe') if ebuildDir.exists(): ebuildDir.rmtree() ebuildDir.makedirs() os.chdir(ebuildDir) newEbuildFilename.copy(ebuildDir) # Copy the patch file filesDir = ebuildDir/'files' filesDir.makedirs() Path(tmp/'exe/installs/gentoo/all-config.patch').copy(filesDir) # Remove any old source if it exists and we're supposed to download # it if '--local' not in sys.argv: oldTarball = Path('/usr/portage/distfiles/')/tarball.basename() if oldTarball.exists(): oldTarball.remove() os.environ['GENTOO_MIRRORS']='' os.system('ebuild %s fetch' % newEbuildFilename.basename()) os.system('ebuild %s manifest' % newEbuildFilename.basename()) os.system('ebuild %s digest' % newEbuildFilename.basename()) if '--install' in sys.argv: os.system('ebuild %s install' % newEbuildFilename.basename())
inputf = args[0] try: outputf = args[1] except IndexError: outputf = None if len(args) > 2: parser.error(_(u'Bad number of arguments supplied').encode(sys.stdout.encoding)) tempdir = TempDirPath() if options.set_options: try: path = Path(inputf) path.copy(tempdir) inputf = tempdir / path.basename() pkg = Package.load(inputf) if not pkg: error = _(u"Invalid input package") raise Exception(error.encode(sys.stdout.encoding)) set_options = options.set_options.split(',') for set_option in set_options: name, value = set_option.split('=') names = name.split('.') obj = pkg for name in names[:-1]: obj = getattr(obj, name) name = names[-1] prop_type = type(getattr(obj, name)) print("Printing name and value..")
# ----------------------------------------------------------------------------- # S c r i p t e x e c u t i o n -- Runs when invoked from the command line -- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # if __name__ == "__main__": usage = "usage: %prog [options]" parser = OptionParser(usage) parser.add_option("-n", "--new", action="store_true", dest="preserve_new", default=False, help="create new .mo files for languages that are not yet in SVN") (options, args) = parser.parse_args() # Move to the right dir curdir = Path('.').abspath() if curdir.basename() == 'exe': if 'locale' in [p.relpath() for p in curdir.dirs()]: (curdir/'..').chdir() elif curdir.basename() == 'locale': (curdir/'..'/'..').chdir() print 'Running from: %s' % Path('.').abspath() # make sure any old build is not around to be scanned for strings shutil.rmtree('build', ignore_errors=True) shutil.rmtree('debian/python2.4-exe', ignore_errors=True) shutil.rmtree('debian/python2.5-exe', ignore_errors=True) shutil.rmtree('debian/python-exe', ignore_errors=True) try: os.remove('debian') except OSError: pass # Fill out the options
# if __name__ == "__main__": usage = "usage: %prog [options]" parser = OptionParser(usage) parser.add_option( "-n", "--new", action="store_true", dest="preserve_new", default=False, help="create new .mo files for languages that are not yet in SVN") (options, args) = parser.parse_args() # Move to the right dir curdir = Path('.').abspath() if curdir.basename() == 'exe': if 'locale' in [p.relpath() for p in curdir.dirs()]: (curdir / '..').chdir() elif curdir.basename() == 'locale': (curdir / '..' / '..').chdir() print 'Running from: %s' % Path('.').abspath() # make sure any old build is not around to be scanned for strings shutil.rmtree('build', ignore_errors=True) shutil.rmtree('debian/python2.4-exe', ignore_errors=True) shutil.rmtree('debian/python2.5-exe', ignore_errors=True) shutil.rmtree('debian/python-exe', ignore_errors=True) try: os.remove('debian') except OSError: pass # Fill out the options