當前位置: 首頁>>代碼示例>>Python>>正文


Python PyGlassEnvironment.isWindows方法代碼示例

本文整理匯總了Python中pyglass.app.PyGlassEnvironment.PyGlassEnvironment.isWindows方法的典型用法代碼示例。如果您正苦於以下問題:Python PyGlassEnvironment.isWindows方法的具體用法?Python PyGlassEnvironment.isWindows怎麽用?Python PyGlassEnvironment.isWindows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyglass.app.PyGlassEnvironment.PyGlassEnvironment的用法示例。


在下文中一共展示了PyGlassEnvironment.isWindows方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _compileImpl

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import isWindows [as 別名]
    def _compileImpl(self):

        #-------------------------------------------------------------------------------------------
        # CHECK IF ANDROID PROJECT FILES EXIST
        createLibrary = False
        if not os.path.exists(self.getTargetPath('android')):
            os.makedirs(self.getTargetPath('android'))
            createLibrary = True
        if not createLibrary:
            for item in ['build.xml', 'AndroidManifest.xml']:
                if not os.path.exists(self.getTargetPath('android', item)):
                    createLibrary = True
                    break

        #-------------------------------------------------------------------------------------------
        # CREATE/UPDATE ANDROID PROJECT
        cmd = ['"%s%s"' % (
            self._owner.mainWindow.getAndroidSDKPath('tools', 'android', isFile=True),
            '.bat' if PyGlassEnvironment.isWindows() else '')
        ]

        if createLibrary:
            messageHeader = 'CREATING ANDROID PROJECT'
            cmd += [
                'create', 'project',
                '--activity', self._settings.targetName,
                '--package', self._settings.ident
            ]
        else:
            messageHeader = 'UPDATING ANDROID PROJECT'
            cmd += ['update', 'project']

        cmd += [
            '--target', '"android-%s"' % str(self._settings.androidTargetVersion),
            '--name', self._settings.targetName,
            '--path', self.getTargetPath() + 'android'
        ]

        if self.executeCommand(cmd, messageHeader):
            self._log.write('FAILED: ANDROID PROJECT MODIFICATIONS')
            return False

        self._log.write('SUCCESS: UPDATE COMPLETE')
        self._log.write('JDK PATH: ' + self._owner.mainWindow.getJavaJDKPath())

        #-------------------------------------------------------------------------------------------
        # CLEAN PROJECT FOR FRESH COMPILATION
        batchCmd = [
            'set JAVA_HOME=%s' % self._owner.mainWindow.getJavaJDKPath(),
            'cd "%s"'  % (self.getTargetPath() + 'android'),
            'set errorlevel=',
            '%s %s' % (self._owner.mainWindow.getJavaAntPath('bin', 'ant.bat'), 'clean')
        ]

        if self.executeBatchCommand(batchCmd, messageHeader='CLEANING ANDROID PROJECT'):
            self._log.write('FAILED: PROJECT CLEANUP')
            return False
        self._log.write('SUCCESS: PROJECT CLEANED')

        #-------------------------------------------------------------------------------------------
        # COPY SUPPORT LIBRARIES
        if 'V4_SUPPORT' in self._settings.androidLibIncludes:
            self._log.write('Including Android V4 Support library...')
            self._copyV4SupportLib()

        #-------------------------------------------------------------------------------------------
        # COMPILE APK
        libsPath = self.getTargetPath('android', 'libs')
        if not os.path.exists(libsPath):
            os.makedirs(libsPath)

        for item in AndroidCompiler.FLASH_LIBS:
            shutil.copy2(
                self.getAirPath('lib', 'android', item),
                self.getTargetPath('android', 'libs', item)
            )

        batchCmd = [
            'set JAVA_HOME=%s' % self._owner.mainWindow.getJavaJDKPath(),
            'cd "%s"'  % (self.getTargetPath() + 'android'),
            'set errorlevel=',
            '%s %s' % (
                self._owner.mainWindow.getJavaAntPath('bin', 'ant.bat'),
                'debug' if self._settings.debug else 'release'
            )
        ]

        if self.executeBatchCommand(batchCmd, messageHeader='COMPILING ANDROID APK'):
            self._log.write('FAILED: APK COMPILATION')
            return False
        self._log.write('SUCCESS: APK COMPILED')

        #-------------------------------------------------------------------------------------------
        # INCLUDE EXTERNAL JAR LIBRARIES
        libSources = []
        libsPath   = self.getTargetPath('android', 'libs')
        ignores    = AndroidCompiler.FLASH_LIBS + AndroidCompiler.IGNORE_LIBS
        for item in os.listdir(libsPath):
            if item in ignores or not item.endswith('.jar'):
                continue
#.........這裏部分代碼省略.........
開發者ID:sernst,項目名稱:CompilerDeck,代碼行數:103,代碼來源:AndroidCompiler.py


注:本文中的pyglass.app.PyGlassEnvironment.PyGlassEnvironment.isWindows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。