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


Python SystemUtils.copy方法代码示例

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


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

示例1: _copy

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import copy [as 别名]
    def _copy(self, source, destination):
        result = SystemUtils.copy(source, destination)
        if not result:
            print 'FAILED TO COPY: %s -> %s' % (source, destination)
            return False

        print 'COPIED: %s -> %s' % (source, destination)
        return True
开发者ID:hannahp,项目名称:PyAid,代码行数:10,代码来源:SystemCommandIssuer.py

示例2: print

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import copy [as 别名]
localDatabasePath = FileUtils.createPath(
    rootPath, '..', 'resources', 'local', 'apps', 'Cadence', 'data', isDir=True)

if not os.path.exists(localDatabasePath):
    print('[ERROR]: No local database resource folder exists')
    sys.exit(1)

for filename in os.listdir(localDatabasePath):
    if StringUtils.begins(filename, '.'):
        # Skip '.' hidden files
        continue

    source = FileUtils.createPath(localDatabasePath, filename)
    target = FileUtils.createPath(inputPath, filename)

    if not SystemUtils.copy(source, target):
        print('[ERROR]: Failed to copy "%s" database file from local app resources' % filename)
        sys.exit(2)
    print('[COPIED]: %s -> %s' % (
        filename,
        target.replace(FileUtils.getDirectoryOf(rootPath), '') ))

#---------------------------------------------------------------------------------------------------
# OUTPUTS

outputPath = FileUtils.createPath(rootPath, 'output', isDir=True)
if os.path.exists(outputPath):
    SystemUtils.remove(outputPath)
os.makedirs(outputPath)

开发者ID:sernst,项目名称:Cadence,代码行数:31,代码来源:initializeStatsEnv.py

示例3: print

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import copy [as 别名]
from pyaid.json.JSON import JSON
from pyaid.system.SystemUtils import SystemUtils

FOLDER_NAME = 'Statistical-Results'

#---------------------------------------------------------------------------------------------------

rootPath = FileUtils.getDirectoryOf(__file__)
localAnalysisPath = FileUtils.makeFolderPath(rootPath, '..', 'resources', 'local', 'analysis')
analysisConfigPath = FileUtils.makeFilePath(localAnalysisPath, 'analysis.json')

config = JSON.fromFile(analysisConfigPath)

if 'OUTPUT_PATH' not in config:
    rootTargetPath = localAnalysisPath
else:
    rootTargetPath = FileUtils.cleanupPath(config['OUTPUT_PATH'], isDir=True)

targetPath = FileUtils.makeFolderPath(rootTargetPath, FOLDER_NAME)

if os.path.exists(targetPath):
    SystemUtils.remove(targetPath)

outputPath = FileUtils.makeFolderPath(rootPath, 'output')

if not SystemUtils.copy(outputPath, targetPath, echo=True):
    print('[FAILED]: Deployment')
    sys.exit(1)

print('Deployment Complete')
开发者ID:sernst,项目名称:Cadence,代码行数:32,代码来源:deployResults.py

示例4: _compileImpl

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import copy [as 别名]
    def _compileImpl(self):
        sets = self._settings
        os.chdir(sets.projectPath)

        adtPath     = self.getAirPath('bin', 'adt', isFile=True)
        swcRootPath = FileUtils.createPath(sets.projectPath, 'swc', isDir=True)

        buildPath = FileUtils.createPath(sets.projectPath, 'build', isDir=True)
        SystemUtils.remove(buildPath)
        os.makedirs(buildPath)

        sets.setPlatform(FlexProjectData.DEFAULT_PLATFORM)

        swcPath = FileUtils.createPath(
            swcRootPath,
            sets.getSetting('FOLDER'),
            sets.getSetting('FILENAME') + '.swc',
            isFile=True)

        cmd = [adtPath,
            '-package',
            '-target', 'ane', sets.getSetting('FILENAME') + '.ane', 'extension.xml',
            '-swc', swcPath]

        platforms = [
            (FlexProjectData.DEFAULT_PLATFORM, 'default', None),
            (FlexProjectData.ANDROID_PLATFORM, 'Android-ARM', 'jar'),
            (FlexProjectData.IOS_PLATFORM, 'iPhone-ARM', 'a'),
            (FlexProjectData.WINDOWS_PLATFORM, 'Windows-x86', None),
            (FlexProjectData.MAC_PLATFORM, 'MacOS-x86', None)]

        platformsData = []
        for platformDef in platforms:
            if not sets.setPlatform(platformDef[0]):
                continue

            platformFolder = sets.getSetting('FOLDER')

            platformBuildPath = FileUtils.createPath(buildPath, platformFolder, isDir=True, noTail=True)
            os.makedirs(platformBuildPath)

            # LIBRARY.SWF
            SystemUtils.copy(
                FileUtils.createPath(
                    sets.projectPath, 'swc', platformFolder, 'extracted', 'library.swf', isFile=True),
                FileUtils.createPath(platformBuildPath, 'library.swf', isFile=True) )

            # NATIVE LIBRARY
            nativeLibrary = sets.getSetting('NATIVE_LIBRARY')
            if nativeLibrary:
                SystemUtils.copy(
                    FileUtils.createPath(sets.projectPath, platformFolder, nativeLibrary, isFile=True),
                    FileUtils.createPath(buildPath, platformFolder, nativeLibrary, isFile=True))

            # Android RES folder
            if platformDef[0] == FlexProjectData.ANDROID_PLATFORM:
                FileUtils.mergeCopy(
                    FileUtils.createPath(sets.projectPath, platformFolder, 'res', isDir=True),
                    FileUtils.createPath(buildPath, platformFolder, 'res', isDir=True))

            cmd.extend(['-platform', platformDef[1]])

            optionsPath = FileUtils.createPath(
                sets.projectPath, platformFolder, 'platform.xml', isFile=True, noTail=True)
            if os.path.exists(optionsPath):
                cmd.extend(['-platformoptions', '"%s"' % optionsPath])

            cmd.extend(['-C', platformBuildPath, '.'])

            data = dict(
                nativeLibrary=nativeLibrary,
                definition=platformDef,
                folder=platformFolder,
                initializer=sets.getSetting('INITIALIZER'),
                finalizer=sets.getSetting('FINALIZER'))
            platformsData.append(data)

        self._createExtensionDescriptor(platformsData)
        result = self.executeCommand(cmd, 'PACKAGING ANE')

        # Cleanup deployed library.swf files
        SystemUtils.remove(buildPath)

        if result:
            self._log.write('PACKAGING FAILED')
            return False

        self._log.write('PACKAGED SUCCEEDED')
        return True
开发者ID:sernst,项目名称:CompilerDeck,代码行数:91,代码来源:NativeExtensionCompiler.py

示例5: _handleReplaceDatabase

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import copy [as 别名]
    def _handleReplaceDatabase(self):

        self.mainWindow.showLoading(
            self,
            u'Browsing for Database File',
            u'Choose a valid database (*.vcd) file')

        defaultPath = self.appConfig.get(UserConfigEnum.DATABASE_IMPORT_PATH)
        if not defaultPath:
            defaultPath = self.appConfig.get(UserConfigEnum.LAST_BROWSE_PATH)

        path = PyGlassBasicDialogManager.browseForFileOpen(
            parent=self,
            caption=u'Select Database File',
            defaultPath=defaultPath)
        self.mainWindow.hideLoading(self)

        if not path:
            self.mainWindow.toggleInteractivity(True)
            return

        # Store directory for later use
        self.appConfig.set(
            UserConfigEnum.DATABASE_IMPORT_PATH,
            FileUtils.getDirectoryOf(path) )

        self.mainWindow.showStatus(
            self,
            u'Replacing Database File',
            u'Removing existing database file and replacing it with selection')

        sourcePath = getattr(Tracks_Track, 'URL')[len(u'sqlite:'):].lstrip(u'/')
        if not OsUtils.isWindows():
            sourcePath = u'/' + sourcePath

        savePath = '%s.store' % sourcePath
        try:
            if os.path.exists(savePath):
                SystemUtils.remove(savePath, throwError=True)
        except Exception as err:
            self.mainWindow.appendStatus(
                self, u'<span style="color:#CC3333">ERROR: Unable to access database save location.</span>')
            self.mainWindow.showStatusDone(self)
            return

        try:
            SystemUtils.move(sourcePath, savePath)
        except Exception as err:
            self.mainWindow.appendStatus(
                self, u'<span style="color:#CC3333;">ERROR: Unable to modify existing database file.</span>')
            self.mainWindow.showStatusDone(self)
            return

        try:
            SystemUtils.copy(path, sourcePath)
        except Exception as err:
            SystemUtils.move(savePath, sourcePath)
            self.mainWindow.appendStatus(
                self, u'<span style="color:#CC3333;">ERROR: Unable to copy new database file.</span>')
            self.mainWindow.showStatusDone(self)
            return

        if os.path.exists(savePath):
            SystemUtils.remove(savePath)

        self.mainWindow.appendStatus(self, u'<span style="color:#33CC33;">Database Replaced</span>')
        self.mainWindow.showStatusDone(self)
开发者ID:sernst,项目名称:Cadence,代码行数:69,代码来源:DatabaseManagerWidget.py


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