def subst(self): if not OsUtils.isWin(): return def _subst(path, drive): if not os.path.exists(path): os.makedirs(path) SetupHelper._getOutput( ["subst", CraftCore.settings.get("ShortPath", drive), path]) if CraftCore.settings.getboolean("ShortPath", "Enabled", False): with TemporaryUseShortpath(False): if ("ShortPath", "RootDrive") in CraftCore.settings: _subst(CraftStandardDirs.craftRoot(), "RootDrive") if ("ShortPath", "DownloadDrive") in CraftCore.settings: _subst(CraftStandardDirs.downloadDir(), "DownloadDrive") if ("ShortPath", "GitDrive") in CraftCore.settings: _subst(CraftStandardDirs.gitDir(), "GitDrive") if CraftCore.settings.getboolean("ShortPath", "EnableJunctions", False): with TemporaryUseShortpath(False): if ("ShortPath", "JunctionDrive") in CraftCore.settings: _subst(CraftCore.standardDirs._junctionDir.longPath, "JunctionDrive")
def __init__(self, filename=None): if filename == None: with TemporaryUseShortpath(False): filename = os.path.join(CraftStandardDirs.etcBlueprintDir(), 'install.db') self.dbfilename = filename self._prepareDatabase()
def subst(self): if not OsUtils.isWin(): return def _subst(path, drive): if not os.path.exists(path): os.makedirs(path) self._getOutput("subst {drive} {path}".format(drive=craftSettings.get("ShortPath", drive),path=path)) if craftSettings.getboolean("ShortPath", "Enabled", False): with TemporaryUseShortpath(False): if ("ShortPath", "RootDrive") in craftSettings: _subst(CraftStandardDirs.craftRoot(), "RootDrive") if ("ShortPath", "DownloadDrive") in craftSettings: _subst(CraftStandardDirs.downloadDir(), "DownloadDrive") if ("ShortPath", "GitDrive") in craftSettings: _subst(CraftStandardDirs.gitDir(), "GitDrive") if craftSettings.getboolean("ShortPath", "EnableJunctions", False): with TemporaryUseShortpath(False): if ("ShortPath", "JunctionDrive") in craftSettings: _subst(CraftStandardDirs.junctionsDir(getDir=True), "JunctionDrive")
def printBanner(self): def printRow(name, value): log(f"{name:20}: {value}") if CraftStandardDirs.isShortPathEnabled(): with TemporaryUseShortpath(False): printRow("Craft Root", CraftStandardDirs.craftRoot()) printRow("Craft", CraftStandardDirs.craftRoot()) printRow("Svn directory", CraftStandardDirs.svnDir()) printRow("Git directory", CraftStandardDirs.gitDir()) else: printRow("Craft", CraftStandardDirs.craftRoot()) printRow("Version", SetupHelper.CraftVersion) printRow("ABI", CraftCore.compiler) printRow("Download directory", CraftStandardDirs.downloadDir())
def printBanner(self): def printRow(name, value): log(f"{name:20}: {value}") if CraftStandardDirs.isShortPathEnabled(): with TemporaryUseShortpath(False): printRow("Craft Root", CraftStandardDirs.craftRoot()) printRow("Craft", CraftStandardDirs.craftRoot()) printRow("Version", SetupHelper.CraftVersion) printRow("ABI", craftCompiler) printRow("Svn directory", CraftStandardDirs.svnDir()) printRow("Git directory", CraftStandardDirs.gitDir()) printRow("Download directory", CraftStandardDirs.downloadDir()) if "CraftDeprecatedEntryScript" in os.environ: oldScript = os.environ["CraftDeprecatedEntryScript"] ext = ".ps1" if OsUtils.isWin() else ".sh" log(f"You used the deprecated script {oldScript}\n" f"Please use craftenv{ext} instead")
def _prepareDatabase(self): """ prepare a new database and add the required table layout """ with TemporaryUseShortpath(False): if not os.path.exists(self.dbfilename): if not os.path.exists(CraftStandardDirs.etcBlueprintDir()): os.makedirs(CraftStandardDirs.etcBlueprintDir()) self.connection = sqlite3.connect(self.dbfilename) cursor = self.connection.cursor() # first, create the required tables cursor.execute( '''CREATE TABLE packageList (packageId INTEGER PRIMARY KEY AUTOINCREMENT, prefix TEXT, packagePath TEXT, version TEXT, revision TEXT)''' ) cursor.execute( '''CREATE TABLE fileList (fileId INTEGER PRIMARY KEY AUTOINCREMENT, packageId INTEGER, filename TEXT, fileHash TEXT)''' ) self.connection.commit() else: self.connection = sqlite3.connect(self.dbfilename)