当前位置: 首页>>代码示例>>Python>>正文


Python FolderDeleter.delete方法代码示例

本文整理汇总了Python中appy.shared.utils.FolderDeleter.delete方法的典型用法代码示例。如果您正苦于以下问题:Python FolderDeleter.delete方法的具体用法?Python FolderDeleter.delete怎么用?Python FolderDeleter.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appy.shared.utils.FolderDeleter的用法示例。


在下文中一共展示了FolderDeleter.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createDistRelease

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def createDistRelease(self):
     """Create the distutils package."""
     curdir = os.getcwd()
     distFolder = "%s/dist" % self.genFolder
     # Create setup.py
     os.mkdir(distFolder)
     f = file("%s/setup.py" % distFolder, "w")
     # List all packages to include
     packages = []
     os.chdir(os.path.dirname(appyPath))
     for dir, dirnames, filenames in os.walk("appy"):
         if self.isDistExcluded(dir):
             continue
         packageName = dir.replace("/", ".")
         packages.append('"%s"' % packageName)
     f.write(distInfo % (self.versionShort, ",".join(packages)))
     f.close()
     # Create MANIFEST.in
     f = file("%s/MANIFEST.in" % distFolder, "w")
     f.write(manifestInfo)
     f.close()
     # Move appy sources within the dist folder
     os.rename("%s/appy" % self.genFolder, "%s/appy" % distFolder)
     # Create the source distribution
     os.chdir(distFolder)
     self.executeCommand("python setup.py sdist")
     # DistUtils has created the .tar.gz file. Move it to folder "versions"
     name = "appy-%s.tar.gz" % self.versionShort
     os.rename("%s/dist/%s" % (distFolder, name), "%s/versions/%s" % (appyPath, name))
     # Clean temp files
     os.chdir(curdir)
     # Keep the Appy source for building the Debian package afterwards
     os.rename(os.path.join(self.genFolder, "dist", "appy"), os.path.join(self.genFolder, "appy"))
     FolderDeleter.delete(os.path.join(self.genFolder, "dist"))
     return name
开发者ID:a-iv,项目名称:appy,代码行数:37,代码来源:publish.py

示例2: zipResult

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def zipResult(self, eggFullName, eggTempFolder):
     '''Zips the result and removes the egg temp folder.'''
     zipFile = zipfile.ZipFile(eggFullName, 'w', zipfile.ZIP_DEFLATED)
     # Put the Python module inside the egg.
     prefix = os.path.dirname(eggTempFolder)
     for dir, dirnames, filenames in os.walk(eggTempFolder):
         for f in filenames:
             fileName = os.path.join(dir, f)
             zipFile.write(fileName, fileName[len(prefix):])
     # Put the Appy module inside it if required.
     if self.includeAppy:
         eggPrefix = '%s/%s' % (eggTempFolder[len(prefix):],
                                self.moduleName.replace('.', '/'))
         # Where is Appy?
         appyPath = os.path.dirname(appy.__file__)
         appyPrefix = os.path.dirname(appyPath)
         # Clean the Appy folder
         Cleaner().run(verbose=False)
         # Insert appy files into the zip
         for dir, dirnames, filenames in os.walk(appyPath):
             if not self.dirInZip(dir): continue
             for f in filenames:
                 fileName = os.path.join(dir, f)
                 zipName = eggPrefix + fileName[len(appyPrefix):]
                 zipFile.write(fileName, zipName)
     zipFile.close()
     # Remove the temp egg folder.
     FolderDeleter.delete(eggTempFolder)
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:30,代码来源:eggify.py

示例3: eggify

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def eggify(self):
     '''Let's wrap a nice Python module into an ugly egg.'''
     j = os.path.join
     # First, clean the Python module
     cleanFolder(self.pythonModule, verbose=False)
     # Create the egg folder
     eggFullName = j(self.eggFolder, self.eggName)
     if os.path.exists(eggFullName):
         os.remove(eggFullName)
         print('Existing "%s" was removed.' % eggFullName)
     # Create a temp folder where to store the egg
     eggTempFolder = os.path.splitext(eggFullName)[0]
     if os.path.exists(eggTempFolder):
         FolderDeleter.delete(eggTempFolder)
         print('Removed "%s" that was in my way.' % eggTempFolder)
     os.mkdir(eggTempFolder)
     # Create the "Products" sub-folder if we must wrap the package in this
     # namespace
     eggModulePath = j(j(eggTempFolder, self.moduleName.replace('.', '/')))
     # Copy the Python module into the egg.
     os.makedirs(eggModulePath)
     copyFolder(self.pythonModule, eggModulePath)
     # Create setup files in the root egg folder
     self.createSetupFile(eggTempFolder)
     self.createInitFile(eggTempFolder)
     self.zipResult(eggFullName, eggTempFolder)
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:28,代码来源:eggify.py

示例4: __init__

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def __init__(self):
     # Delete the "egg" folder on not-yet-copied local site.
     eggFolder = "%s/temp/egg" % appyPath
     if os.path.isdir(eggFolder):
         FolderDeleter.delete(eggFolder)
     # Ask user id and password for FTP transfer
     userId, userPassword = askLogin()
     self.site = ftplib.FTP(self.name)
     self.site.login(userId, userPassword)
     self.rootFolder = None  # Root folder of appy site ~FtpFolder~
     self.currentFolder = None  # Currently visited folder ~FtpFolder~
开发者ID:a-iv,项目名称:appy,代码行数:13,代码来源:publish.py

示例5: __init__

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def __init__(self, app, pythonVersions=('2.6',)):
     self.appName = os.path.basename(app)
     self.pythonVersions = pythonVersions
     appFolder = os.path.dirname(app)
     # Prepare the output folder (remove any existing one)
     cortexFolder = os.path.join(appFolder, 'cortex.admin')
     if os.path.exists(cortexFolder):
         FolderDeleter.delete(cortexFolder)
     allFolders = os.path.join(cortexFolder, 'applications', self.appName)
     os.makedirs(allFolders)
     self.out = allFolders
开发者ID:Sateanu,项目名称:django-sis,代码行数:13,代码来源:packaging.py

示例6: run

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def run(self, verbose=True):
     cleanFolder(appyPath, verbose=verbose)
     # Remove all files in temp folders
     for tempFolder in ('%s/temp' % appyPath,
                        '%s/pod/test/temp' % appyPath):
         if os.path.exists(tempFolder):
             FolderDeleter.delete(tempFolder)
     # Remove test reports if any
     for testReport in ('%s/pod/test/Tester.report.txt' % appyPath,):
         if os.path.exists(testReport):
             os.remove(testReport)
开发者ID:a-iv,项目名称:appy,代码行数:13,代码来源:clean.py

示例7: finalize

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def finalize(self):
     msg = '%d/%d successful test(s)' % \
           (self.nbOfSuccesses, (self.nbOfTests-self.nbOfIgnoredTests))
     if self.nbOfIgnoredTests >0:
         msg += ', but %d ignored test(s) not counted' % \
                self.nbOfIgnoredTests
     msg += '.'
     self.report.say(msg, force=True)
     self.report.close()
     if not self.keepTemp:
         if os.path.exists(self.tempFolder):
             FolderDeleter.delete(self.tempFolder)
开发者ID:a-iv,项目名称:appy,代码行数:14,代码来源:test.py

示例8: setStylesMapping

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def setStylesMapping(self, stylesMapping):
     '''Establishes a correspondence between, on one hand, CSS styles or
        XHTML tags that will be found inside XHTML content given to POD,
        and, on the other hand, ODT styles found into the template.'''
     try:
         stylesMapping = self.stylesManager.checkStylesMapping(stylesMapping)
         self.stylesManager.setStylesMapping(stylesMapping)
     except PodError, po:
         self.contentParser.env.currentBuffer.content.close()
         self.stylesParser.env.currentBuffer.content.close()
         if os.path.exists(self.tempFolder):
             FolderDeleter.delete(self.tempFolder)
         raise po
开发者ID:tonibagur,项目名称:appy,代码行数:15,代码来源:renderer.py

示例9: run

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def run(self):
     '''Renders the result.'''
     try:
         # Remember which parser is running
         self.currentParser = self.contentParser
         # Create the resulting content.xml
         self.currentParser.parse(self.contentXml)
         self.currentParser = self.stylesParser
         # Create the resulting styles.xml
         self.currentParser.parse(self.stylesXml)
         # Patch META-INF/manifest.xml
         self.patchManifest()
         # Re-zip the result
         self.finalize()
     finally:
         FolderDeleter.delete(self.tempFolder)
开发者ID:Alejoss,项目名称:django-sis,代码行数:18,代码来源:renderer.py

示例10: run

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def run(self):
     self.report.say('-' * 79)
     self.report.say('- Test %s.' % self.data['Name'])
     self.report.say('- %s\n' % self.description)
     # Prepare test data
     self.tempFolder = os.path.join(self.testFolder, 'temp')
     if os.path.exists(self.tempFolder):
         FolderDeleter.delete(self.tempFolder)
     os.mkdir(self.tempFolder)
     try:
         self.do()
         self.report.say('Checking result...')
         testFailed = self.checkResult()
     except:
         testFailed = self.onError()
     self.finalize()
     return testFailed
开发者ID:tonibagur,项目名称:appy,代码行数:19,代码来源:test.py

示例11: run

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def run(self):
     Cleaner().run(verbose=False)
     # Perform a small analysis on the Appy code
     LinesCounter(appy).run()
     print 'Generating site in %s...' % self.genFolder
     minimalist = askQuestion('Minimalist (shipped without tests)?',
                              default='no')
     self.prepareGenFolder(minimalist)
     self.createDocToc()
     self.applyTemplate()
     self.createZipRelease()
     #self.createCodeAndEggReleases()
     if askQuestion('Do you want to publish the site on ' \
                    'appyframework.org?', default='no'):
         AppySite().publish()
     if askQuestion('Delete locally generated site ?', default='no'):
         FolderDeleter.delete(self.genFolder)
开发者ID:ajmirsky,项目名称:appy,代码行数:19,代码来源:publish.py

示例12: run

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def run(self):
     self.report.say('-' * 79)
     self.report.say('- Test %s.' % self.data['Name'])
     self.report.say('- %s\n' % self.description)
     # Prepare test data
     self.tempFolder = os.path.join(self.testFolder, 'temp', self.data['Name'])
     if os.path.exists(self.tempFolder):
         time.sleep(0.3) # Sometimes I can't remove it, so I wait
         FolderDeleter.delete(self.tempFolder)
     os.makedirs(self.tempFolder)
     try:
         self.do()
         self.report.say('Checking result...')
         testFailed = self.checkResult()
     except:
         testFailed = self.onError()
     self.finalize()
     return testFailed
开发者ID:PeterEymann,项目名称:appypod,代码行数:20,代码来源:test.py

示例13: run

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def run(self):
     Cleaner().run(verbose=False)
     # Perform a small analysis on the Appy code
     LinesCounter(appy).run()
     print "Generating site in %s..." % self.genFolder
     minimalist = self.askQuestion("Minimalist (shipped without tests)?", default="no")
     self.prepareGenFolder(minimalist)
     self.createDocToc()
     self.applyTemplate()
     self.createZipRelease()
     tarball = self.createDistRelease()
     self.createDebianRelease()
     if self.askQuestion("Upload %s on PyPI?" % tarball, default="no"):
         self.uploadOnPypi(tarball)
     if self.askQuestion("Publish on appyframework.org?", default="no"):
         AppySite().publish()
     if self.askQuestion("Delete locally generated site ?", default="yes"):
         FolderDeleter.delete(self.genFolder)
开发者ID:a-iv,项目名称:appy,代码行数:20,代码来源:publish.py

示例14: setStylesMapping

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def setStylesMapping(self, stylesMapping):
     '''Establishes a correspondance between, on one hand, CSS styles or
        XHTML tags that will be found inside XHTML content given to POD,
        and, on the other hand, ODT styles found into the template.'''
     try:
         stylesMapping = self.stylesManager.checkStylesMapping(stylesMapping)
         # The predefined styles below are currently ignored, because the
         # xhtml2odt parser does not take into account span tags.
         if 'span[font-weight=bold]' not in stylesMapping:
             stylesMapping['span[font-weight=bold]'] = 'podBold'
         if 'span[font-style=italic]' not in stylesMapping:
             stylesMapping['span[font-style=italic]'] = 'podItalic'
         self.stylesManager.stylesMapping = stylesMapping
     except PodError, po:
         self.contentParser.env.currentBuffer.content.close()
         self.stylesParser.env.currentBuffer.content.close()
         if os.path.exists(self.tempFolder):
             FolderDeleter.delete(self.tempFolder)
         raise po
开发者ID:Alejoss,项目名称:django-sis,代码行数:21,代码来源:renderer.py

示例15: walkFile

# 需要导入模块: from appy.shared.utils import FolderDeleter [as 别名]
# 或者: from appy.shared.utils.FolderDeleter import delete [as 别名]
 def walkFile(self, fileName):
     '''Unzip p_fileName in a temp folder, call self.script, and then re-zip
        the result.'''
     print 'Walking %s...' % fileName
     # Create a temp folder
     name = 'f%f' % time.time()
     tempFolder = os.path.join(self.tempFolder, name)
     os.mkdir(tempFolder)
     # Unzip the file in it
     unzip(fileName, tempFolder)
     # Call self.script
     py = sys.executable or 'python'
     cmd = [py, self.script, tempFolder]
     print '  Running %s...' % cmd,
     out, err = executeCommand(cmd)
     # Re-zip the result
     zip(fileName, tempFolder, odf=True)
     FolderDeleter.delete(tempFolder)
     print 'done.'
开发者ID:tonibagur,项目名称:appy,代码行数:21,代码来源:odfwalk.py


注:本文中的appy.shared.utils.FolderDeleter.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。