def createProject(): """ Turns a software package into PyCharm project. For this some files within ".idea" are created. """ BuildSystemTools.requireTopLevelDir() configDir = '.idea' logging.info('creating config in %s', configDir) projectRoot = ProjectProperties.detectTopLevelDir() if projectRoot is None: raise RuntimeError('unable to detect top-level-directory of package') packageName = ProjectProperties.getPackageName(projectRoot) packageVersion = ProjectProperties.getPackageVersion(projectRoot) Any.requireIsTextNonEmpty(packageName) Any.requireIsTextNonEmpty(packageVersion) template = PackageCreator_JetBrains_PyCharm_Config(packageName, packageVersion, outputDir=configDir) template.run()
def ensureHasDependency(content, package): """ Ensures if the direct dependencies/inclusions are present or not in the provided string (= CMakeLists.txt file content). """ Any.requireIsTextNonEmpty(content) ProjectProperties.requireIsCanonicalPath(package) logging.debug('Validating CMakeLists.txt') category, name, version = ProjectProperties.splitPath(package) pkgNoVersion = os.path.join(category, name) found = False for dep in getDependencies(content): if dep.find(pkgNoVersion) > 0: found = True logging.debug('%s dependency already present', pkgNoVersion) if found: return content else: logging.debug('inserting dependency to: %s', package) return insertDependency(content, package)
def _createCellWidget(self, package): Any.requireMsg( Any.isInstance( package, BSTPackage.BSTPackage ) or \ Any.isInstance( package, DebianPackage ), 'unexpected datatype: %s' % type(package) ) Any.requireIsTextNonEmpty(package.url) cell = QTreeWidgetItem([package.url]) inSystem = self._model.isInstalled_locally inProxy = self._model.isInstalled_proxySIT inGlobal = self._model.isInstalled_globalSIT ProjectProperties.requireIsCanonicalPath(SIT.strip(package.url)) if package.url.startswith('sit://'): if self._hasProxy: self._setCellColorCode(cell, 1, inProxy(package.url)) else: self._setCellColorCode(cell, 1, None) self._setCellColorCode(cell, 2, inGlobal(package.url)) self._setCellColorCode(cell, 3, None) else: self._setCellColorCode(cell, 1, None) self._setCellColorCode(cell, 2, None) self._setCellColorCode(cell, 3, inSystem(package.url)) return cell
def open( self, package=None ): if self.url: ProjectProperties.requireIsURL( self.url ) package = ProjectProperties.splitURL( self.url )[1] else: ProjectProperties.requireIsCanonicalPath( package ) topLevelDir = os.path.join( SIT.getRootPath(), package ) super( BSTGloballyInstalledPackage, self ).open( topLevelDir )
def listDependencies(canonicalPath, reverse=False, recursive=True, missingOnly=False, asList=False, showDuplicates=False): if missingOnly: asList = True reverse = False # if '.' provided as package, read dependencies from ./pkgInfo.py, # otherwise work on SIT level if canonicalPath == '.' and not reverse: try: requireTopLevelDir() except RuntimeError as details: raise SystemExit(details) package = BSTPackage.BSTSourcePackage() package.open(os.getcwd()) else: if canonicalPath == '.': # implies reverse == True requireTopLevelDir() package = BSTPackage.BSTSourcePackage() package.open(os.getcwd()) canonicalPath = package.detector.canonicalPath # strip-off the SIT part if provided, and convert to URL-style ProjectProperties.requireIsCanonicalPath(canonicalPath) packageURL = 'sit://' + canonicalPath package = BSTPackage.BSTProxyInstalledPackage(packageURL) try: package.open() except AssertionError as details: logging.error(details) logging.error('%s: No such package in SIT' % canonicalPath) raise SystemExit() if reverse: package.retrieveReverseDependencies(recursive) else: package.retrieveDependencies(recursive, normalDeps=True, buildDeps=False) if asList: _showAsList(package, reverse, missingOnly) else: _showAsTree(package, reverse, recursive, showDuplicates)
def printFetchCommands(packageList, asSubModule=True): """ Prints the VCS fetch command for each package in the list. Duplicates will be removed, and output will be sorted for better readability, e.g.: asSubModule = True: git submodule add [email protected]:TECH_Team/BPL.git git submodule add [email protected]:ToolBOS/BasicComponents.git git submodule add [email protected]:ToolBOS/ToolBOSLib.git asSubModule = False: git clone [email protected]:TECH_Team/BPL.git git clone [email protected]:ToolBOS/BasicComponents.git git clone [email protected]:ToolBOS/ToolBOSLib.git """ Any.requireIsIterable(packageList) Any.requireIsBool(asSubModule) sitRootPath = SIT.getRootPath() commands = set() # avoids duplicates for canonicalPath in packageList: ProjectProperties.requireIsCanonicalPath(canonicalPath) installRoot = os.path.join(sitRootPath, canonicalPath) Any.requireIsExisting(installRoot) detector = PackageDetector.PackageDetector(installRoot) detector.retrieveMetaInfoFromSIT() vcsRoot = detector.vcsRoot if vcsRoot: Any.requireIsTextNonEmpty(vcsRoot) repo = VersionControl.auto(vcsRoot) if isinstance(repo, SVN.SVNRepository): repo.setConfiguredUserName() command = repo.getSourceCodeCommand() elif isinstance(repo, Git.RemoteGitRepository): command = repo.getSourceCodeCommand(asSubModule) else: raise TypeError('unexpected datatype: %s', type(repo)) else: command = '# VCS location unknown: %s' % canonicalPath commands.add(command) for command in sorted(commands): print(command)
def test_isDeprecated( self ): canonicalPath = ToolBOSSettings.canonicalPath logging.info( 'testing canonicalPath=%s' % canonicalPath ) ProjectProperties.requireIsCanonicalPath( canonicalPath ) # ToolBOSCore never becomes deprecated, I hope ;-) self.assertFalse( ProjectProperties.isDeprecated( canonicalPath ) ) # check for invalid parameter types (boolean + list) self.assertRaises( AssertionError, ProjectProperties.isDeprecated, True ) self.assertRaises( AssertionError, ProjectProperties.isDeprecated, [ 1, 2, 3 ] )
def getReverseDependencies(self, packageURL): ProjectProperties.requireIsURL(packageURL) result = set() for candidateURL, detector in self._cache.items(): ProjectProperties.requireIsURL(candidateURL) if packageURL in detector.dependencies: result.add(candidateURL) return result
def getIndexFileName(canonicalPath): """ Returns the RTMaps index filename for the package. Example: 'Horp_ToolBOS_1.0.pck' """ ProjectProperties.requireIsCanonicalPath(canonicalPath) tmp = ProjectProperties.splitPath(canonicalPath) result = '%s_%s.pck' % (tmp[1], tmp[2]) Any.requireIsTextNonEmpty(result) return result
def create(self): """ Creates a new SVN repository. If the repository shall be on another server than 'localhost', SSH will be used to tunnel the execution of commands. """ from ToolBOSCore.Packages import ProjectProperties tmp1 = parse.urlsplit(self.url) server = tmp1.netloc repoDir = tmp1.path server = None if server is '' else server if server: # if not set create on localhost Any.requireIsTextNonEmpty(server) Any.requireIsTextNonEmpty(repoDir) repoRoot, category, packageName = ProjectProperties.splitPath(repoDir) repoParent = os.path.dirname(repoDir) logging.debug('repoRoot: %s', repoRoot) logging.debug('repoParent: %s', repoParent) logging.debug('repoDir: %s', repoDir) logging.debug('category: %s', category) logging.debug('package name: %s', packageName) logging.debug('server: %s', server) logging.info('creating directory structure') cmd = "mkdir -p %s" % repoDir FastScript.execProgram(cmd, host=server, workingDir='/') logging.info('creating new repository') cmd = "svnadmin create --fs-type fsfs %s" % packageName FastScript.execProgram(cmd, host=server, workingDir=repoParent) # verify that it exists now Any.requireMsg(self.exists(), "failed to create repository (reason is unclear)") # As decided by HRI-EU's Security Group in April 2009, new SVN # repositories will be protected from world access by default. # Beside the owner, only the same group can access repositories. # Manual interference is necessary to change this upon demand. if server: groupName = FastScript.getCurrentGroupName() logging.info('granting group read-permission (%s)' % groupName) cmd = "chmod 2770 db db/transactions db/revs db/revprops && " + \ "chmod 660 db/write-lock && chmod 750 hooks && " + \ "chmod 770 locks && chmod o-r * && chmod o-w * && " + \ "chmod o-x * && chmod -R g-w db && chmod 0750 ." FastScript.execProgram(cmd, host=server, workingDir=repoDir) else: logging.warning( 'setting repository permissions on local ' + \ 'filesystem not implemented, yet' )
def showStatistics(): """ Shows few numbers on current SIT such as number of packages. """ from ToolBOSCore.Packages import ProjectProperties path = getRootPath() total = [] pkgRoots = [] pkgVersions = 0 regexp = re.compile("^(\d+)\.(\d+)$") Any.requireMsg(regexp, 'internal script error: empty regexp') getProjectsWithErrorHandling(path, total) for package in total: pkgRoot = os.path.dirname(package) version = ProjectProperties.getPackageVersion(package, True) if pkgRoot not in pkgRoots: pkgRoots.append(pkgRoot) # if this package is one with a 2-digit version, add it to the # number of 2-digit-packages if regexp.match(version): pkgVersions += 1 logging.info('path: %s' % path) logging.info('number of distinct packages: %d' % len(pkgRoots)) logging.info('number of 2-digit-versions: %d' % pkgVersions) logging.info('number of 3-digit-versions (= total): %d' % len(total))
def _showAsList(package, reverse, missingOnly): """ Direcyly print list of [reverse] dependencies onto console. """ Any.requireIsInstance(package, BSTPackage.BSTPackage) Any.requireIsBool(reverse) data = package.revDepSet if reverse else package.depSet Any.requireIsSet(data) packageURLs = list(data) packageURLs.sort() for packageURL in packageURLs: Any.requireIsTextNonEmpty(packageURL) if missingOnly: try: if not ProjectProperties.isInstalled(packageURL): print(packageURL) except EnvironmentError: # unknown, treat as "not installed" print(packageURL) else: print(packageURL)
def getPixmap(name): """ Returns a QPixmap for the provided 'name', which used to be the short form of a filename (without path and file extension). """ Any.requireIsTextNonEmpty(name) global _pixmapCache global _pixmapDir try: # lookup cache return _pixmapCache[name] except KeyError: if _pixmapDir is None: scriptDir = os.path.dirname(sys.argv[0]) topLevelDir = ProjectProperties.detectTopLevelDir(scriptDir) _pixmapDir = os.path.join(topLevelDir, 'share/pixmaps') Any.requireIsDir(_pixmapDir) filePath = os.path.join(_pixmapDir, name + '.png') Any.requireIsFile(filePath) logging.debug('using pixmap: %s', filePath) # load pixmap and put in cache pixmap = QPixmap(filePath) _pixmapCache[pixmap] = pixmap return pixmap
def _getInstallStatus(self, package, sitPath): try: installed = ProjectProperties.isInstalled(package, sitPath) except ValueError: installed = False if installed: if package.startswith('sit://'): msg = '%s: exists' % \ os.path.join( sitPath, SIT.strip( package) ) else: msg = '%s: installed on this machine' % \ package.replace( 'deb://', '' ) else: if package.startswith('sit://'): msg = '%s: no such file or directory' % \ os.path.join( sitPath, SIT.strip( package ) ) else: msg = '%s: not installed on this machine' % \ package.replace( 'deb://', '' ) return installed, msg
def printBuildCommands(orderedList): """ Prints the build-instruction for each package in the list, e.g.: build src/ToolBOSCore build src/ToolBOSLib build src/IniConfigFile build src/Middleware Note: The list shall already be sorted according to build order! """ Any.requireIsListNonEmpty(orderedList) sitRootPath = SIT.getRootPath() commands = [] for canonicalPath in orderedList: ProjectProperties.requireIsCanonicalPath(canonicalPath) installRoot = os.path.join(sitRootPath, canonicalPath) Any.requireIsExisting(installRoot) detector = PackageDetector.PackageDetector(installRoot) detector.retrieveMetaInfoFromSIT() vcsRelPath = detector.vcsRelPath vcsRoot = detector.vcsRoot if vcsRoot: Any.requireIsTextNonEmpty(vcsRoot) repo = VersionControl.auto(vcsRoot) repoName = repo.getRepositoryName() if vcsRelPath: location = os.path.join('src', repoName, vcsRelPath) else: location = os.path.join('src', repoName) command = 'build %s' % location else: command = '# build %s# location unknown' % canonicalPath.ljust(70) commands.append(command) for command in commands: print(command)
def getIndexFilePath_relHGR(canonicalPath, rtmapsVersion, platform): """ Returns a path to the *.pck index filename for the package, relative to ${SIT}. Example: package = 'Modules/BBCM/InputOutput/UltimaTest/3.1' """ ProjectProperties.requireIsCanonicalPath(canonicalPath) Any.requireIsTextNonEmpty(rtmapsVersion) Any.requireIsTextNonEmpty(platform) result = os.path.join('Modules/Index', rtmapsVersion, platform, getIndexFileName(canonicalPath)) Any.requireIsTextNonEmpty(result) return result
def sourceWindowsBSP(msvc): """ Loads the necessary ToolBOSPluginWindows so that Wine and MSVC will be found in PATH etc. """ allBSPs = ToolBOSSettings.getConfigOption('BST_crossCompileBSPs') Any.requireIsDictNonEmpty(allBSPs) if msvc in (2010, 2012): canonicalPath = allBSPs['windows-amd64-vs2012'] elif msvc == 2017: canonicalPath = allBSPs['windows-amd64-vs2017'] else: raise RuntimeError('sourceWindowsBSP: unsupported MSVC version: %s' % msvc) ProjectProperties.requireIsCanonicalPath(canonicalPath) ProcessEnv.source(canonicalPath)
def retrieveReverseDependencies( self, recursive ): self._ensureMetaInfoCache() self.revDepSet = set() self.revDepTree = list() for depURL in self._metaInfoCache.getReverseDependencies( self.url ): ProjectProperties.requireIsURL( depURL ) # no Debian packages can appear in reverse dependencies of SIT packages depPackage = BSTInstalledPackage( depURL ) depPackage.detector = self._metaInfoCache.getDetector( depURL ) if recursive: depPackage.retrieveReverseDependencies( recursive ) self.revDepSet.update( depPackage.revDepSet ) self.revDepSet.add( depURL ) self.revDepTree.append( depPackage )
def populate(self): """ Scans all package in SIT and stores the ground-truth pkgInfo.py information into one giant hashtable for later fast access. The assignment is "packageURL": { pkgInfo data } """ sitPath = SIT.getPath() canonicalPaths = SIT.getCanonicalPaths(sitPath) Any.requireIsListNonEmpty(canonicalPaths) for canonicalPath in canonicalPaths: ProjectProperties.requireIsCanonicalPath(canonicalPath) packageURL = 'sit://' + canonicalPath installRoot = os.path.join(sitPath, canonicalPath) detector = PackageDetector(installRoot) detector.retrieveMakefileInfo() self._cache[packageURL] = detector
def createProject(): """ Turns a software package into CLion project. For this some files within ".idea" are created. """ BuildSystemTools.requireTopLevelDir() configDir = '.idea' logging.info('creating config in %s', configDir) projectRoot = ProjectProperties.detectTopLevelDir() packageName = ProjectProperties.getPackageName(projectRoot) packageVersion = ProjectProperties.getPackageVersion(projectRoot) Any.requireIsTextNonEmpty(packageName) Any.requireIsTextNonEmpty(packageVersion) template = PackageCreator_JetBrains_CLion_Config(packageName, packageVersion, outputDir=configDir) template.run()
def insertDependency(content, package): """ Inserts the direct dependencies/inclusions if not found in the provided string (= CMakeLists.txt file content). """ Any.requireIsTextNonEmpty(content) ProjectProperties.requireIsCanonicalPath(package) # insert after last occurrence of bst_find_package modified = content.splitlines() index = 0 for line in modified: if line.startswith('bst_find_package'): index = modified.index(line) + 1 if index == 0: # if there was no bst_find_package() yet then append at the end index = len(modified) modified.insert(index, 'bst_find_package(%s)' % package) return '\n'.join(modified)
def makeCategoryWriteable(sitPath, project, groupName='hriall', mode=0o0775): """ Changes the group and permissions of all directories between 'sitPath' up to the project version (the project's main directory will also be group-writeable so that different developers could install different versions. Mind to provide an octal number as 'mode'!) """ from ToolBOSCore.Packages import ProjectProperties Any.requireIsDir(sitPath) Any.requireIsTextNonEmpty(project) Any.requireIsTextNonEmpty(groupName) Any.requireIsIntNotZero(mode) # <mode> must be an octal number ProjectProperties.requireIsCanonicalPath(project) # The current HRI-EU install procedure is implemented in a way that it always # attempts to change ownership of the category INCLUDING the SIT root # directory. Instead of fixing this there (time-consuming, error-prone) we # always set it here as a shortcut. FastScript.setGroupPermission(sitPath, groupName, mode) # cut off the project version tmp = ProjectProperties.splitPath(project) mainDir = os.path.join(tmp[0], tmp[1]) tokens = mainDir.split(os.sep) # the current path we are operating on with chmod+chgrp, starting from # sitPath curPath = sitPath # for each token in category do a chmod+chgrp for token in tokens: curPath = os.path.join(curPath, token) FastScript.setGroupPermission(curPath, groupName, mode)
def isTopLevelDir( path='.' ): """ Returns a boolean whether or not the provided directory is the top-level-directory of a source package. """ regExpVersion = re.compile( "^(\d+\.\d+).*$" ) projectVersion = ProjectProperties.getPackageVersion( path, verbatim=True ) versionDirFound = bool( regExpVersion.search( projectVersion ) ) if versionDirFound: return True else: return os.path.exists( 'CMakeLists.txt' ) or \ os.path.exists( 'packageVar.cmake' ) or \ os.path.exists( 'pkgInfo.py' )
def retrieveMaintainer(self): try: data = self.pkgInfoContent['maintainer'] except (KeyError, TypeError): # TypeError: pkgInfo might be None data = ProjectProperties.getMaintainerFromFilesystem( self.canonicalPath) except AssertionError: logging.debug('%s: not a canonical path', self.canonicalPath) return except OSError: # unable to determine maintainer from SIT return if isinstance(data, tuple): self.maintainerAccount = data[0] self.maintainerName = data[1] else: Any.requireIsTextNonEmpty(data) self.maintainerAccount = data self.maintainerName = data
def _onDependencyCheckFinished( self, terminal, output ): Any.requireIsInstance( terminal, TerminalWidget.TerminalWidget ) Any.requireIsInstance( output, QByteArray ) missingDeps = [] utf8Output = output.data() strOutput = utf8Output.decode( 'utf-8' ) lines = strOutput.splitlines() for line in lines: if ProjectProperties.isURL( line ): missingDeps.append( line ) else: logging.debug( 'unexpected output: %s', line ) self._depCheckers[ terminal ] = None if missingDeps: logging.debug( 'found missing deps: %s', missingDeps ) self._reportMissingDependencies( terminal, missingDeps )
def retrieveMetaInfoFromSIT(self): """ Helper function which retrieves as much as possible information from a package installed into SIT, f.i. all info from pkgInfo.py. """ self._parsePkgInfo() self.vcsRevision = self.gitCommitIdLong if self.gitOrigin and self.gitCommitIdLong: self.vcsBranch = self.gitBranch self.vcsRevision = self.gitCommitIdLong self.vcsRelPath = self.gitRelPath self.vcsURL = self.gitOrigin self.vcsRoot = self.gitOrigin Any.requireIsTextNonEmpty(self.vcsURL) Any.requireIsTextNonEmpty(self.vcsRevision) Any.isOptional(self.vcsRelPath) elif self.svnRepositoryURL and self.svnRevision: self.vcsURL = self.svnRepositoryURL self.vcsRevision = self.svnRevision self.vcsRelPath = self.svnRelPath self.vcsRoot = self.svnRepositoryRoot # svnRelPath is not present in pkgInfo.py but solely computed # from the svnRepositoryURL and svnRepositoryRoot self.svnRelPath = os.path.relpath(self.svnRepositoryURL, self.svnRepositoryRoot) self.vcsRelPath = self.svnRelPath Any.requireIsTextNonEmpty(self.vcsURL) Any.requireIsTextNonEmpty(self.vcsRoot) Any.requireIsIntNotZero(self.vcsRevision) Any.isOptional(self.vcsRelPath) if not self.vcsURL: logging.debug('neither SVN nor Git repository information found') self.isDeprecated = ProjectProperties.isDeprecated(self.canonicalPath)
def retrieveDependencies( self, recursive, normalDeps=True, buildDeps=False, recommendations=False, suggestions=False ): Any.requireIsNotNone( self.detector, 'Please call .open() first' ) Any.requireIsBool( recursive ) Any.requireIsBool( normalDeps ) Any.requireIsBool( buildDeps ) Any.requireIsBool( recommendations ) Any.requireIsBool( suggestions ) self.detector.retrieveMakefileInfo() self.depSet = set() self.depTree = list() debPrefix = 'deb://' sitPrefix = 'sit://' hostPlatform = getHostPlatform() if normalDeps: self.depSet = set( self.detector.dependencies ) try: self.depSet.update( self.detector.dependsArch[ hostPlatform ] ) except KeyError: pass # no such setting, this is OK if buildDeps: self.depSet.update( self.detector.buildDependencies ) try: self.depSet.update( self.detector.buildDependsArch[ hostPlatform ] ) except KeyError: pass # no such setting, this is OK # create a temporary copy of self.depSet while iterating, # otherwise leads to "RuntimeError: Set changed size during iteration" for packageURL in copy.copy( self.depSet ): ProjectProperties.requireIsURL( packageURL ) error = False if packageURL.startswith( sitPrefix ): depPkg = BSTProxyInstalledPackage( packageURL ) try: depPkg.open() if recursive: depPkg.retrieveDependencies( recursive, normalDeps, buildDeps, recommendations, suggestions ) else: depPkg.depSet = set() depPkg.depTree = list() except AssertionError as details: logging.debug( details ) depPkg.depSet = set() depPkg.depTree = list() error = True elif packageURL.startswith( debPrefix ): depPkg = DebianPackage( packageURL ) try: depPkg.retrieveDependencies() except EnvironmentError as details: logging.warning( details ) depPkg.depSet = set() depPkg.depTree = list() else: raise ValueError( 'Unknown URL prefix in "%s"' % packageURL ) if not error: self.depSet.update( depPkg.depSet ) self.depSet.add( packageURL ) self.depTree.append( depPkg )
def registerNormalPackage(package, sitProxyPath=None, indexBaseDir=None, dryRun=False): """ Creates a symlink to the *.pck file of 'package' within the RTMaps index. RTMAPS_VERSION is taken from the dependency list of the package. """ if sitProxyPath is None: sitProxyPath = SIT.getPath() if indexBaseDir is None: indexBaseDir = getIndexBaseDir(sitProxyPath) ProjectProperties.requireIsCanonicalPath(package) Any.requireIsDir(sitProxyPath) Any.requireIsDir(indexBaseDir) Any.requireIsBool(dryRun) platformList = getPlatformNames() packageName = ProjectProperties.getPackageName(package) packageVersion = ProjectProperties.getPackageVersion(package) versionTokens = ProjectProperties.splitVersion(packageVersion) majorVersion = int(versionTokens[0]) minorVersion = int(versionTokens[1]) installRoot = os.path.join(sitProxyPath, package) Any.requireIsListNonEmpty(platformList) Any.requireIsTextNonEmpty(packageName) Any.requireIsTextNonEmpty(packageVersion) Any.requireIsDir(installRoot) deps = ProjectProperties.getDependencies(package) try: Any.requireIsListNonEmpty(deps) except AssertionError: logging.debug( 'empty list of dependencies in RTMaps package is unplausible') msg = "%s: unable to retrieve dependencies, please check SIT installation" % package raise ValueError(msg) expr = re.compile('^sit://External/RTMaps/(\d+\.\d+)') # detect RTMaps version used by package rtmapsVersion = '' for dep in deps: tmp = expr.match(dep) if tmp: rtmapsVersion = tmp.group(1) break Any.requireIsTextNonEmpty(rtmapsVersion) logging.debug('%s depends on RTMaps %s', package, rtmapsVersion) libDir = os.path.join(installRoot, 'lib') pckFiles = FastScript.findFiles(libDir, ext='.pck') Any.requireMsg( len(pckFiles) > 0, package + ": No *.pck file found, forgot to compile?") for relPath in pckFiles: pckFileName = os.path.basename(relPath) pckPackage = os.path.splitext(pckFileName)[0] pckFileExt = os.path.splitext(pckFileName)[1] logging.debug('registering %s', pckPackage) for platform in platformList: pckPath = os.path.join(libDir, platform, pckFileName) dstDir = os.path.join(indexBaseDir, rtmapsVersion, platform) if os.path.exists(pckPath): symlinkFile = '%s_%d.%d%s' % (pckPackage, majorVersion, minorVersion, pckFileExt) symlinkPath = os.path.join(dstDir, symlinkFile) target = pckPath FastScript.link(target, symlinkPath, dryRun)
def __init__( self, url ): super( DebianPackage, self ).__init__( url ) self.isInstalled = None self.name = ProjectProperties.splitURL( url )[1] self.url = url
package = SIT.strip(args['package']) # strip-off the SIT part if provided userName = args['user'] #---------------------------------------------------------------------------- # Main program #---------------------------------------------------------------------------- # When using shell tab-completion on SIT paths for the canonical path, # a trailing slash might be added. Remove this before proceeding. if package.endswith('/'): package = package[:-1] logging.debug('package truncated to: %s', package) try: ProjectProperties.requireIsCanonicalPath(package) except AssertionError as details: logging.error(details) raise SystemExit # look for repository URL sitPath = SIT.getPath() installRoot = os.path.join(sitPath, package) url = None detector = None try: detector = PackageDetector.PackageDetector(installRoot) except AssertionError: pass # package not found in SIT