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


Python SystemUtils.executeCommand方法代码示例

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


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

示例1: _createMacDmg

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _createMacDmg(self, binPath):
        print 'CREATING Mac DMG'
        target   = FileUtils.createPath(binPath, self.application.appID + '.dmg', isFile=True)
        tempTarget = FileUtils.createPath(binPath, 'pack.tmp.dmg', isFile=True)
        distPath = FileUtils.createPath(binPath, 'dist', isDir=True, noTail=True)

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

        cmd = ['hdiutil', 'create', '-size', '500m', '"%s"' % tempTarget, '-ov', '-volname',
            '"%s"' % self.appDisplayName, '-fs', 'HFS+', '-srcfolder', '"%s"' % distPath]

        result = SystemUtils.executeCommand(cmd, wait=True)
        if result['code']:
            print 'Failed Command Execution:'
            print result
            return False

        cmd = ['hdiutil', 'convert', "%s" % tempTarget, '-format', 'UDZO', '-imagekey',
               'zlib-level=9', '-o', "%s" % target]

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

        result = SystemUtils.executeCommand(cmd)
        if result['code']:
            print 'Failed Command Execution:'
            print result
            return False

        SystemUtils.remove(tempTarget)
        return True
开发者ID:hannahp,项目名称:PyGlass,代码行数:34,代码来源:PyGlassApplicationCompiler.py

示例2: compileCoffeescriptFile

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def compileCoffeescriptFile(cls, source, destFolder, minify =True):
        iniDirectory = os.curdir
        os.chdir(os.path.dirname(source))

        cmd = cls.modifyNodeCommand([
            StaticFlowEnvironment.getNodeCommandAbsPath('coffee'),
            '--output', '"%s"' % FileUtils.stripTail(destFolder),
            '--compile', '"%s"' % source ])

        result = SystemUtils.executeCommand(cmd)
        if not minify or result['code']:
            os.chdir(iniDirectory)
            return result

        name = os.path.splitext(os.path.basename(source))[0] + '.js'
        dest = FileUtils.createPath(destFolder, name, isFile=True)

        tempOutPath = dest + '.tmp'
        shutil.move(dest, tempOutPath)

        cmd = cls.modifyNodeCommand([
            StaticFlowEnvironment.getNodeCommandAbsPath('uglifyjs'),
            '"%s"' % tempOutPath,
            '>',
            '"%s"' % dest ])

        result = SystemUtils.executeCommand(cmd)
        os.remove(tempOutPath)
        os.chdir(iniDirectory)
        return result
开发者ID:sernst,项目名称:StaticFlow,代码行数:32,代码来源:SiteProcessUtils.py

示例3: _createIcon

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _createIcon(self, binPath):
        iconPath = self._getIconPath()
        if not iconPath:
            return iconPath

        if os.path.isfile(iconPath):
            return iconPath

        #-------------------------------------------------------------------------------------------
        # MAC ICON CREATION
        #       On OSX use Apple's iconutil (XCode developer tools must be installed) to create an
        #       icns file from the icons.iconset folder at the specified location.
        if OsUtils.isMac():
            targetPath = FileUtils.createPath(binPath, self.appDisplayName + '.icns', isFile=True)
            result = SystemUtils.executeCommand([
                'iconutil', '-c', 'icns', '-o', '"' + targetPath + '"', '"' + iconPath + '"'])
            if result['code']:
                return ''
            return targetPath

        #-------------------------------------------------------------------------------------------
        # WINDOWS ICON CREATION
        #       On Windows use convert (ImageMagick must be installed and on the PATH) to create an
        #       ico file from the icons folder of png files.
        result = SystemUtils.executeCommand('where convert')
        if result['code']:
            return ''
        items = result['out'].replace('\r', '').strip().split('\n')
        convertCommand = None
        for item in items:
            if item.find('System32') == -1:
                convertCommand = item
                break
        if not convertCommand:
            return ''

        images = os.listdir(iconPath)
        cmd = ['"' + convertCommand + '"']
        for image in images:
            if not StringUtils.ends(image, ('.png', '.jpg')):
                continue
            imagePath = FileUtils.createPath(iconPath, image, isFile=True)
            cmd.append('"' + imagePath + '"')
        if len(cmd) < 2:
            return ''

        targetPath = FileUtils.createPath(binPath, self.appDisplayName + '.ico', isFile=True)
        cmd.append('"' + targetPath + '"')

        result = SystemUtils.executeCommand(cmd)
        if result['code'] or not os.path.exists(targetPath):
            print 'FAILED:'
            print result['command']
            print result['error']
            return ''

        return targetPath
开发者ID:hannahp,项目名称:PyGlass,代码行数:59,代码来源:PyGlassApplicationCompiler.py

示例4: _handleOpenDocumentsInFinder

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _handleOpenDocumentsInFinder(self):
        snap = self._getLatestBuildSnapshot()
        data = FlexProjectData(**snap)
        path = FileUtils.createPath(
            os.path.expanduser('~'), 'Library', 'Application Support',
            'iPhone Simulator', '7.0.3', 'Applications', data.appId, isDir=True)

        cmd = ['open', '"%s"' % path]

        print 'COMMAND:', cmd
        SystemUtils.executeCommand(cmd)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:13,代码来源:DeckCompileWidget.py

示例5: save

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def save(self, toPDF=True):
        """ Writes the current _drawing in SVG format to the file specified at initialization. If
            one wishes to have create a PDF file (same file name as used for the .SVG, but with
            suffix .PDF), then call with toPDF True). """

        if not self.siteMapReady:
            return

        # Make sure the directory where the file will be saved exists before saving
        FileUtils.getDirectoryOf(self._drawing.filename, createIfMissing=True)

        self._drawing.save()

        #  we're done if no PDF version is also required
        if not toPDF:
            return

        # strip any extension off of the file name
        basicName = self.fileName.split(".")[0]

        # load up the command
        cmd = ["/Applications/Inkscape.app/Contents/Resources/bin/inkscape", "-f", None, "-A", None]
        cmd[2] = basicName + ".svg"
        cmd[4] = basicName + ".pdf"

        # and execute it
        response = SystemUtils.executeCommand(cmd)
        if response["error"]:
            print("response[error]=%s" % response["error"])
开发者ID:sernst,项目名称:Cadence,代码行数:31,代码来源:CadenceDrawing.py

示例6: executeCommand

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def executeCommand(self, cmd, messageHeader =None, message =None):
        if isinstance(cmd, list):
            cmd = ' '.join(cmd)

        if messageHeader:
            self.printCommand(message if message else cmd, messageHeader)

        result = SystemUtils.executeCommand(cmd)
        self._commandBuffer.append([result['error'], result['out']])

        out = ''
        if result['out']:
            out += '<br /><br />' \
                   + '<div style="color:#999999"><span style="font-size:16px">RESULTS:</span>\n' \
                   + 50*'- ' + '\n' + str(result['out']) + '</div>'
        if result['error']:
            out += '<br /><br />' \
                   + '<div style="color:#993333"><span style="font-size:16px">ERRORS:</span>\n' \
                   + 50*'- ' + '\n' + str(result['error']) + '</div>'
        if out:
            self._log.write(out + '\n\n')

        self._checkOutput(result['code'], result['out'], result['error'])

        if result['code']:
            return result['code']
        return 0
开发者ID:sernst,项目名称:CompilerDeck,代码行数:29,代码来源:SystemCompiler.py

示例7: startServer

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def startServer(cls, path):
        """ RUN NGINX
            NGinx is started as an active process.
        """

        cls.initializeEnvironment(path)
        os.chdir(path)
        print 'STARTING SERVER AT:', path
        return SystemUtils.executeCommand('nginx')
开发者ID:sernst,项目名称:NGinxWinManager,代码行数:11,代码来源:NGinxRunOps.py

示例8: run

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

        # Create the bin directory where the output will be stored if it does not already exist
        binPath = self.getBinPath(isDir=True)
        if not os.path.exists(binPath):
            os.makedirs(binPath)

        # Remove any folders created by previous build attempts
        for d in self._CLEANUP_FOLDERS:
            path = os.path.join(binPath, d)
            if os.path.exists(path):
                shutil.rmtree(path)

        os.chdir(binPath)

        ResourceCollector(self, verbose=True).run()

        cmd = [
            FileUtils.makeFilePath(sys.prefix, 'bin', 'python'),
            '"%s"' % self._createSetupFile(binPath),
            OsUtils.getPerOsValue('py2exe', 'py2app'), '>',
            '"%s"' % self.getBinPath('setup.log', isFile=True)]

        print('[COMPILING]: Executing %s' % OsUtils.getPerOsValue('py2exe', 'py2app'))
        print('[COMMAND]: %s' % ' '.join(cmd))
        result = SystemUtils.executeCommand(cmd, remote=False, wait=True)
        if result['code']:
            print('COMPILATION ERROR:')
            print(result['out'])
            print(result['error'])
            return False

        if self.appFilename and OsUtils.isWindows():
            name   = self.applicationClass.__name__
            source = FileUtils.createPath(binPath, 'dist', name + '.exe', isFile=True)
            dest   = FileUtils.createPath(binPath, 'dist', self.appFilename + '.exe', isFile=True)
            os.rename(source, dest)

        if OsUtils.isWindows() and not self._createWindowsInstaller(binPath):
            print('Installer Creation Failed')
            return False
        elif OsUtils.isMac() and not self._createMacDmg(binPath):
            print('DMG Creation Failed')
            return False

        # Remove the resources path once compilation is complete
        resourcePath = FileUtils.createPath(binPath, 'resources', isDir=True)
        SystemUtils.remove(resourcePath)

        buildPath = FileUtils.createPath(binPath, 'build', isDir=True)
        SystemUtils.remove(buildPath)

        FileUtils.openFolderInSystemDisplay(binPath)

        return True
开发者ID:sernst,项目名称:PyGlass,代码行数:58,代码来源:PyGlassApplicationCompiler.py

示例9: commandExists

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def commandExists(cls):
        """ DOES THE NGINX COMMAND EXIST?
            NGinx must be a recognized command on the user or system path to be accessible. If the
            command is not found the process is aborted.
        """
        result = SystemUtils.executeCommand('where nginx')
        if result['code']:
            print 'ERROR: Unable to find the nginx command. Is it on your system path?'
            print result['error'].strip()
            return False

        return True
开发者ID:sernst,项目名称:NGinxWinManager,代码行数:14,代码来源:NGinxSetupOps.py

示例10: _runImpl

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

        if not self._settings.hasPlatform(FlexProjectData.IOS_PLATFORM):
            self._log.write('ERROR: No iOS platform information found. Install aborted.')
            return 1

        self._settings.setPlatform(FlexProjectData.IOS_PLATFORM)

        self._log.write(
            '<div style="font-size:24px">Installing IPA...</div>\n'
            + '(This can take a few minutes. Please stand by)'
        )

        if PyGlassEnvironment.isWindows:
            adtCommand = 'adt.bat'
        else:
            adtCommand = 'adt'

        cmd = [
            '"%s"' % self.parent().mainWindow.getRootAIRPath(
                sets.airVersion, 'bin', adtCommand, isFile=True),
            '-installApp',
            '-platform',
            'ios',
            '-package',
            FileUtils.createPath(
                sets.platformDistributionPath, sets.contentTargetFilename + '.' + sets.airExtension)
        ]

        self.log.write('<div style="color:#9999CC">' + '\n'.join(cmd) + '</div>')
        result = SystemUtils.executeCommand(cmd)
        print 'IPA Install:', result

        if result['out']:
            self._log.write(
                '<div style="color:#999999">'
                + '<div style="font-size:18px">Result:'
                + '</div>' + result['out']
                + ('' if result['code'] else ('<br/>' + result['error']))
                + '</div>'
            )

        if result['code'] and result['error']:
            self._log.write(
                '<div style="color:#993333">'
                + '<div style="font-size:18px">Error:'
                + '</div>' + result['error'] + '</div>'
            )

        self._log.write('Installation attempt complete')

        return result['code']
开发者ID:sernst,项目名称:CompilerDeck,代码行数:55,代码来源:InstallIpaThread.py

示例11: _runFlashDebug

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _runFlashDebug(self):
        sets = self._projectData

        cmd = [
            'C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe',
            FileUtils.createPath(sets.platformBinPath, sets.contentTargetFilename + '.swf') ]

        result = SystemUtils.executeCommand(cmd)
        if result['code']:
            self._log.write(result['out'])
            return 1

        return 0
开发者ID:sernst,项目名称:CompilerDeck,代码行数:15,代码来源:AirDebugThread.py

示例12: _runImpl

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _runImpl(self):
        """Doc..."""
        self._log.write('<div style="font-size:24px;">Deploying IOS Simulator</div>')

        sets = self._settings
        sets.setPlatform(FlexProjectData.IOS_PLATFORM)

        adtCommand = self.parent().mainWindow.getRootAIRPath(
            sets.airVersion, 'bin', 'adt', isFile=True)

        targetPath = FileUtils.createPath(
            sets.platformDistributionPath,
            sets.contentTargetFilename + '.' + sets.airExtension,
            isFile=True)

        cmd = [adtCommand, '-installApp', '-platform', 'ios', '-platformsdk',
            '"%s"' % sets.iosSimulatorSdkPath, '-device', 'ios-simulator',
            '-package', targetPath]

        result = SystemUtils.executeCommand(cmd)
        if result['code']:
            self._log.write('Failed simulator installation')
            return 1
        self._log.write('Application installed to simulator')

        cmd = [adtCommand, '-launchApp', '-platform', 'ios', '-platformsdk',
            '"%s"' % sets.iosSimulatorSdkPath, '-device', 'ios-simulator',
            '-appid', '"%s"' % sets.appId]

        self._log.write('Launching simulator')

        result = SystemUtils.executeCommand(cmd)
        if result['code']:
            print result
            self._log.write('Failed simulator execution')
            return 1
        self._log.write('Simulator execution complete')

        return 0
开发者ID:sernst,项目名称:CompilerDeck,代码行数:41,代码来源:IosSimulatorThread.py

示例13: _runClear

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _runClear(self):
        self._log.write(
            '<div style="font-size:24px">Clearing Android Logcat...</div>\n'
        )

        command = 'adb.exe' if OsUtils.isWindows() else 'adb'
        cmd = [
            '"%s"' % self.parent().mainWindow.getAndroidSDKPath('platform-tools', command),
            'logcat',
            '-c'
        ]

        return SystemUtils.executeCommand(cmd)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:15,代码来源:AndroidLogcatThread.py

示例14: _createWindowsInstaller

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _createWindowsInstaller(self, binPath):
        self._createNsisInstallerScript(binPath)

        nsisPath = 'C:\\Program Files (x86)\\NSIS\\makensis.exe'
        if os.path.exists(nsisPath):
            print 'PACKAGING: NSIS Installer'
            result = SystemUtils.executeCommand('"%s" "%s"' % (
                nsisPath, FileUtils.createPath(binPath, 'installer.nsi', isFile=True)))
            if result['code']:
                print 'PACKAGING ERROR:'
                print result['error']
                return False

        return True
开发者ID:hannahp,项目名称:PyGlass,代码行数:16,代码来源:PyGlassApplicationCompiler.py

示例15: _runDump

# 需要导入模块: from pyaid.system.SystemUtils import SystemUtils [as 别名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import executeCommand [as 别名]
    def _runDump(self):
        self._log.write(u'<div style="font-size:24px">Retrieving Android Logcat...</div>\n')

        command = 'adb.exe' if OsUtils.isWindows() else 'adb'
        cmd = [
            '"%s"' % self.parent().mainWindow.getAndroidSDKPath('platform-tools', command),
            'logcat',
            '-d',
            '-v', 'long']

        result = SystemUtils.executeCommand(cmd)
        if 'out' in result:
            out = result['out']

            res = AndroidLogcatThread._LOGCAT_HEADER_RE.finditer(out)
            if res:
                entries = []
                for r in res:
                    if entries:
                        entries[-1]['value'] = out[entries[-1]['res'].end():r.start()].strip()
                    entries.append({
                        'res':r,
                        'level':r.groupdict()['level'],
                        'pid':r.groupdict()['pid'],
                        'time':r.groupdict()['time'],
                        'id':r.groupdict()['id'] })
                if entries:
                    entries[-1]['value'] = out[entries[-1]['res'].end():].strip()

                res = ''
                for item in entries:
                    if 'value' not in item:
                        continue

                    item = self._parseLogEntry(item)

                    if item.ignore:
                        res += u'<div style="color:#999999;font-size:10px;">' + item.value + u'</div>'
                        continue

                    res += u'<div style="font-size:5px;">.</div><div style="color:' + item.color \
                        + u';font-size:14px;">' \
                        + u'<span style="background-color:' + item.backColor \
                        + u';font-size:10px;">[' + item.id \
                        + u']</span> ' + item.value + u'</div><div style="font-size:5px;">.</div>'

                if res:
                    result['out'] = res

        return result
开发者ID:sernst,项目名称:CompilerDeck,代码行数:52,代码来源:AndroidLogcatThread.py


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