1311 return py_dir, "Ui_{0}".format(py_file) |
1312 return py_dir, "Ui_{0}".format(py_file) |
1312 |
1313 |
1313 compileUiDir(sourceDir, True, pyName) |
1314 compileUiDir(sourceDir, True, pyName) |
1314 |
1315 |
1315 |
1316 |
|
1317 def prepareInfoFile(fileName): |
|
1318 """ |
|
1319 Function to prepare an Info.py file when installing from source. |
|
1320 |
|
1321 @param fileName name of the Python file containing the info (string) |
|
1322 """ |
|
1323 if not fileName: |
|
1324 return |
|
1325 |
|
1326 os.rename(fileName, fileName + ".orig") |
|
1327 try: |
|
1328 hgOut = subprocess.check_output(["hg", "identify", "-i"]) |
|
1329 if sys.version_info[0] == 3: |
|
1330 hgOut = hgOut.decode() |
|
1331 except (FileNotFoundError, subprocess.CalledProcessError): |
|
1332 hgOut = "" |
|
1333 if hgOut: |
|
1334 hgOut = hgOut.strip() |
|
1335 if hgOut.endswith("+"): |
|
1336 hgOut = hgOut[:-1] |
|
1337 if sys.version_info[0] == 2: |
|
1338 f = codecs.open(fileName + ".orig", "r", "utf-8") |
|
1339 else: |
|
1340 f = open(fileName + ".orig", "r", encoding="utf-8") |
|
1341 text = f.read() |
|
1342 f.close() |
|
1343 text = text.replace("@@REVISION@@", hgOut) |
|
1344 copyToFile(fileName, text) |
|
1345 else: |
|
1346 shutil.copy(fileName + ".orig", fileName) |
|
1347 |
|
1348 |
1316 def main(argv): |
1349 def main(argv): |
1317 """ |
1350 """ |
1318 The main function of the script. |
1351 The main function of the script. |
1319 |
1352 |
1320 @param argv the list of command line arguments. |
1353 @param argv the list of command line arguments. |
1399 pyqtVariant = "PyQt{0}".format(arg) |
1432 pyqtVariant = "PyQt{0}".format(arg) |
1400 pyqtOverride = True |
1433 pyqtOverride = True |
1401 elif "--noapis": |
1434 elif "--noapis": |
1402 installApis = False |
1435 installApis = False |
1403 |
1436 |
|
1437 infoName = "" |
1404 installFromSource = not os.path.isdir(sourceDir) |
1438 installFromSource = not os.path.isdir(sourceDir) |
1405 if installFromSource: |
1439 if installFromSource: |
1406 sourceDir = os.path.dirname(__file__) or "." |
1440 sourceDir = os.path.dirname(__file__) or "." |
1407 configName = os.path.join(sourceDir, "eric6config.py") |
1441 configName = os.path.join(sourceDir, "eric6config.py") |
|
1442 if os.path.exists(os.path.join(sourceDir, ".hg")): |
|
1443 # we are installing from source with repo |
|
1444 infoName = os.path.join(sourceDir, "UI", "Info.py") |
|
1445 prepareInfoFile(infoName) |
1408 |
1446 |
1409 if len(cfg) == 0: |
1447 if len(cfg) == 0: |
1410 createInstallConfig() |
1448 createInstallConfig() |
1411 |
1449 |
1412 if depChecks: |
1450 if depChecks: |
1487 if os.path.exists(configNameC): |
1525 if os.path.exists(configNameC): |
1488 os.remove(configNameC) |
1526 os.remove(configNameC) |
1489 os.rename(configName + ".orig", configName) |
1527 os.rename(configName + ".orig", configName) |
1490 except EnvironmentError: |
1528 except EnvironmentError: |
1491 pass |
1529 pass |
|
1530 try: |
|
1531 if installFromSource and infoName: |
|
1532 os.remove(infoName) |
|
1533 infoNameC = infoName + 'c' |
|
1534 if os.path.exists(infoNameC): |
|
1535 os.remove(infoNameC) |
|
1536 os.rename(infoName + ".orig", infoName) |
|
1537 except EnvironmentError: |
|
1538 pass |
1492 |
1539 |
1493 print("\nInstallation complete.") |
1540 print("\nInstallation complete.") |
1494 print() |
1541 print() |
1495 |
1542 |
1496 exit(res) |
1543 exit(res) |