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


Python FileUtils.createPath方法代码示例

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


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

示例1: initializeEnvironment

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def initializeEnvironment(cls, path):
        """ CREATE MISSING FILES AND FOLDERS
            Due to the limited file creation privileges while running NGinx as a normal user,
            certain files and folders must exist prior to starting the server.
        """

        for folderParts in cls._NGINX_FOLDERS:
            p = FileUtils.createPath(path, *folderParts, isDir=True)
            if not os.path.exists(p):
                os.makedirs(p)

        for fileParts in cls._NGINX_FILES:
            p = FileUtils.createPath(path, *fileParts, isFile=True)
            if not os.path.exists(p):
                f = open(p, 'w+')
                f.close()

        #-------------------------------------------------------------------------------------------
        # COPY CONF FILES
        #       NGinx requires a number of conf files to be present and comes with a default set of
        #       files, which must be cloned to the target location if they do not already exist.
        nginxExeConfFolder = FileUtils.createPath(NGinxSetupOps.getExePath(), 'conf', isDir=True)
        for item in os.listdir(nginxExeConfFolder):
            itemPath = FileUtils.createPath(nginxExeConfFolder, item)
            if not os.path.isfile(itemPath):
                continue
            targetPath = FileUtils.createPath(path, 'conf', item, isFile=True)
            if os.path.exists(targetPath):
                continue
            shutil.copy(itemPath, targetPath)
开发者ID:sernst,项目名称:NGinxWinManager,代码行数:32,代码来源:NGinxRunOps.py

示例2: _getJDKPath

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def _getJDKPath(cls, *args, **kwargs):
        if cls._JDK_PATH is None:
            jdkPath   = None
            lastParts = [0, 0, 0, 0]
            for root in [cls._PROG_64_PATH, cls._PROG_PATH]:
                for p in os.listdir(FileUtils.createPath(root, 'java')):
                    if not p.lower().startswith('jdk'):
                        continue

                    parts = cls._NUM_FINDER.findall(p)
                    skip  = False
                    index = 0
                    while index < len(lastParts) and index < len(parts):
                        if parts[index] < lastParts[index]:
                            skip = True
                            break
                        index += 1

                    if not skip:
                        lastParts = parts
                        jdkPath   = FileUtils.createPath(cls._PROG_64_PATH, 'java', p)
            cls._JDK_PATH = jdkPath

        if cls._JDK_PATH is None:
            raise Exception, 'Unable to locate a Java Development Kit installation.'

        return FileUtils.createPath(cls._JDK_PATH, *args, **kwargs)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:29,代码来源:CompilerDeckMainWindow.py

示例3: __init__

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def __init__(self, containerPath, isRemoteDeploy =False, sourceRootFolder ='src', **kwargs):
        """Creates a new instance of Site."""
        super(Site, self).__init__()

        self.errorCount     = 0
        self.warningCount   = 0
        self._staticPaths   = []

        self._logger = ArgsUtils.getLogger(self, kwargs)
        self._sourceRootFolderName = sourceRootFolder

        # NGinx root path in which all files reside
        self._containerPath = FileUtils.cleanupPath(containerPath, isDir=True)

        # Location of the source files used to create the website
        self._sourceWebRootPath = FileUtils.createPath(containerPath, sourceRootFolder, isDir=True)

        # Locations where files should be deployed. If the target root path is None, which is the
        # default value, the local web root path is used in its place.

        if isRemoteDeploy:
            self._targetWebRootPath = FileUtils.cleanupPath(
                tempfile.mkdtemp(prefix='staticFlow_'), isDir=True)
        else:
            self._targetWebRootPath = None

        self._localWebRootPath  = FileUtils.createPath(
            containerPath, ArgsUtils.get('localRootFolder', 'root', kwargs), isDir=True)

        path = FileUtils.createPath(self.sourceWebRootPath, '__site__.def', isFile=True)
        try:
            self._data.data = JSON.fromFile(path, throwError=True)
        except Exception, err:
            self.writeLogError(u'Unable to load site definition file: "%s"' % path, error=err)
            pass
开发者ID:sernst,项目名称:StaticFlow,代码行数:37,代码来源:Site.py

示例4: _executeBuildScript

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def _executeBuildScript(self, scriptName):
        pd = self._flexData

        scriptsPath = FileUtils.createPath(pd.projectPath, 'compiler', 'scripts', isDir=True)
        if not os.path.exists(scriptsPath):
            return False

        typePath = FileUtils.createPath(scriptsPath, self._flexData.buildTypeFolderName, isDir=True)
        if not os.path.exists(typePath):
            return False

        platformPath = FileUtils.createPath(typePath, pd.currentPlatformID.lower(), isDir=True)
        if not os.path.exists(platformPath):
            return False

        targetPath = FileUtils.createPath(platformPath, scriptName, isFile=True)
        if not os.path.exists(targetPath):
            targetPath += '.py'
            if not os.path.exists(targetPath):
                return False

        self._log.write('Running post build script: ' + scriptName)
        f = open(targetPath, 'r')
        script = f.read()
        f.close()

        module = imp.new_module('postBuildScriptModule')
        setattr(module, '__file__', targetPath)
        setattr(module, 'logger', self._log)
        setattr(module, 'flexProjectData', self._flexData)
        exec script in module.__dict__
        self._log.write('Post build script execution complete')
开发者ID:sernst,项目名称:CompilerDeck,代码行数:34,代码来源:ANECompileThread.py

示例5: certificate

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def certificate(self):
        """Returns the absolute path to the certificate file needed for packaging."""
        certPaths = [
            FileUtils.createPath(
                self.platformProjectPath, 'cert', self.buildTypeFolderName, isDir=True),
            FileUtils.createPath(self.platformProjectPath, 'cert', isDir=True) ]

        for certPath in certPaths:
            if not os.path.exists(certPath):
                continue

            certFileName = self.getSetting('CERTIFICATE')
            if certFileName is None:
                for path in FileUtils.getFilesOnPath(certPath):
                    if path.endswith('.p12'):
                        return path
                continue

            certFileName = certFileName.replace('\\', '/').strip('/').split('/')
            certPath     = FileUtils.createPath(certPath, certFileName, isFile=True)

            if not os.path.exists(certPath) and os.path.exists(certPath + '.p12'):
                certPath += '.p12'

            if os.path.exists(certPath):
                return certPath

        return None
开发者ID:sernst,项目名称:CompilerDeck,代码行数:30,代码来源:FlexProjectData.py

示例6: appleProvisioningProfile

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def appleProvisioningProfile(self):
        if self._currentPlatformID != self.IOS_PLATFORM:
            return None

        certPaths = [
            FileUtils.createPath(
                self.platformProjectPath, 'cert', self.buildTypeFolderName, isDir=True),
            FileUtils.createPath(self.platformProjectPath, 'cert', isDir=True) ]

        if self.iosAdHoc:
            certPaths.insert(0, FileUtils.createPath(
                self.platformProjectPath, 'cert', 'adhoc', isDir=True))

        for certPath in certPaths:
            if not os.path.exists(certPath):
                continue

            filename = self.getSetting('PROVISIONING_PROFILE', None)
            if filename is None:
                for path in FileUtils.getFilesOnPath(certPath):
                    if path.endswith('.mobileprovision'):
                        return path
                continue

            filename = filename.replace('\\', '/').strip('/').split('/')
            path     = FileUtils.createPath(certPath, filename, isFile=True)
            if not os.path.exists(path) and os.path.exists(path + '.mobileprovision'):
                path += '.mobileprovision'

            if os.path.exists(path):
                return path

        return None
开发者ID:sernst,项目名称:CompilerDeck,代码行数:35,代码来源:FlexProjectData.py

示例7: __init__

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def __init__(self):
        """Creates a new instance of PyGlassApplication."""
        QtCore.QObject.__init__(self)
        self._qApplication = None
        self._window       = None
        self._splashScreen = None

        # Sets a temporary standard out and error for deployed applications in a write allowed
        # location to prevent failed write results.
        if PyGlassEnvironment.isDeployed:
            if appdirs:
                userDir = appdirs.user_data_dir(self.appID, self.appGroupID)
            else:
                userDir = FileUtils.createPath(
                    os.path.expanduser('~'), '.pyglass', self.appGroupID, self.appID, isDir=True)

            path = FileUtils.createPath(
                userDir,
                self.appID + '_out.log', isFile=True)
            folder = FileUtils.getDirectoryOf(path, createIfMissing=True)
            sys.stdout = open(path, 'w+')

            FileUtils.createPath(
                appdirs.user_data_dir(self.appID, self.appGroupID),
                self.appID + '_error.log',
                isFile=True)
            folder = FileUtils.getDirectoryOf(path, createIfMissing=True)
            sys.stderr = open(path, 'w+')

        PyGlassEnvironment.initializeAppSettings(self)
开发者ID:hannahp,项目名称:PyGlass,代码行数:32,代码来源:PyGlassApplication.py

示例8: _createMacDmg

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [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

示例9: deployDebugNativeExtensions

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def deployDebugNativeExtensions(cls, cmd, settings):
        from CompilerDeck.adobe.flex.FlexProjectData import FlexProjectData

        sets = settings
        if not sets.aneIncludes:
            return None

        debugPath = FileUtils.createPath(
            sets.projectPath, 'NativeExtensions', '__debug__', isDir=True, noTail=True)

        if os.path.exists(debugPath):
            SystemUtils.remove(debugPath)
        os.makedirs(debugPath)

        extensionIDs = []
        for ane in sets.aneIncludes:
            anePath = FileUtils.createPath(sets.projectPath, 'NativeExtensions', ane, isDir=True)
            aneSets = FlexProjectData(anePath)
            extensionIDs.append(aneSets.getSetting('ID'))
            aneFilename = aneSets.getSetting('FILENAME')

            aneFile = FileUtils.createPath(anePath, aneFilename + '.ane', isFile=True)
            z = zipfile.ZipFile(aneFile)
            z.extractall(FileUtils.createPath(debugPath, aneFilename + '.ane', isDir=True, noTail=True))

        AirUtils.updateAppExtensions(sets.appDescriptorPath, extensionIDs)

        cmd.extend(['-extdir', '"%s"' % debugPath])
        return debugPath
开发者ID:sernst,项目名称:CompilerDeck,代码行数:31,代码来源:AirUtils.py

示例10: platformProjectPath

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
 def platformProjectPath(self):
     """The root project path for the currently active platform."""
     pid = self._currentPlatformID
     if pid == self.ANDROID_PLATFORM:
         return FileUtils.createPath(self.projectPath, 'android', isDir=True)
     elif pid == self.IOS_PLATFORM:
         return FileUtils.createPath(self.projectPath, 'ios', isDir=True)
     return self.projectPath
开发者ID:sernst,项目名称:CompilerDeck,代码行数:10,代码来源:FlexProjectData.py

示例11: _compileUiFile

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def _compileUiFile(self, path, filename):
        """Doc..."""

        source = FileUtils.createPath(path, filename, isFile=True)
        if self._verbose:
            self._log.write('COMPILING: ' + source)

        if PyGlassEnvironment.isWindows:
            uicCommand = FileUtils.createPath(self._pythonPath, 'Scripts', 'pyside-uic.exe')
        else:
            uicCommand = 'pyside-uic'

        cmd = '%s %s' % (uicCommand, source)
        pipe = subprocess.Popen(
            cmd,
            shell=True,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        out, error = pipe.communicate()

        if pipe.returncode or error:
            self._log.write('ERROR: Failed to compile %s widget: %s' % (str(source), str(error)))
            return False

        res = WidgetUiCompiler._CLASS_NAME_RE.search(out)
        if not res:
            self._log.write('ERROR: Failed to find widget class name for ' + str(source))
            return False
        out = WidgetUiCompiler._CLASS_NAME_RE.sub('PySideUiFileSetup', out, 1)

        res = WidgetUiCompiler._SETUP_UI_RE.search(out)
        if not res:
            self._log.write('ERROR: Failed to find widget setupUi method for ' + str(source))
            return False
        targetName = res.groupdict().get('parentName')
        out = WidgetUiCompiler._SETUP_UI_RE.sub('\g<parentName>', out, 1)

        res = WidgetUiCompiler._RETRANSLATE_RE.search(out)
        if not res:
            self._log.write('ERROR: Failed to find widget retranslateUi method for ' + str(source))
            return False
        out = WidgetUiCompiler._RETRANSLATE_RE.sub('\g<parentName>', out, 1)

        if isinstance(out, unicode):
            out = out.encode('utf8', 'ignore')

        out = WidgetUiCompiler._SELF_RE.sub(targetName + '.', out)

        dest = FileUtils.createPath(path, filename[:-3] + '.py', isFile=True)
        if os.path.exists(dest):
            os.remove(dest)
        f = open(dest, 'w+')
        f.write(out)
        f.close()

        py_compile.compile(dest)
        return True
开发者ID:hannahp,项目名称:PyGlass,代码行数:60,代码来源:WidgetUiCompiler.py

示例12: _createIcon

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [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

示例13: faviconUrl

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def faviconUrl(self):
        path = FileUtils.createPath(self.sourceWebRootPath, 'favicon.png', isFile=True)
        if os.path.exists(path):
            return self.getSiteUrl('/favicon.png')

        path = FileUtils.createPath(self.sourceWebRootPath, 'favicon.ico', isFile=True)
        if os.path.exists(path):
            return self.getSiteUrl('/favicon.ico')
        return None
开发者ID:sernst,项目名称:StaticFlow,代码行数:11,代码来源:Site.py

示例14: path

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [as 别名]
    def path(self):
        if self._common:
            return FileUtils.createPath(
                self._gui.appResourcePath,
                ApplicationConfig._APP_COMMON_CONFIG_FILENAME)

        return FileUtils.createPath(
            self._gui.localAppResourcePath,
            ApplicationConfig._APP_CONFIG_FILENAME)
开发者ID:hannahp,项目名称:PyGlass,代码行数:11,代码来源:ApplicationConfig.py

示例15: run

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import createPath [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


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