1053 args = [ |
1053 args = [ |
1054 sys.executable, |
1054 sys.executable, |
1055 os.path.join(os.path.dirname(__file__), |
1055 os.path.join(os.path.dirname(__file__), |
1056 "create_windows_links.py"), |
1056 "create_windows_links.py"), |
1057 ] |
1057 ] |
1058 subprocess.call(args) # secok |
1058 subprocess.run(args) # secok |
1059 else: |
1059 else: |
1060 print( |
1060 print( |
1061 "\nThe Python package 'pywin32' is not installed. Desktop and" |
1061 "\nThe Python package 'pywin32' is not installed. Desktop and" |
1062 " Start Menu entries will not be created." |
1062 " Start Menu entries will not be created." |
1063 ) |
1063 ) |
1387 else: |
1387 else: |
1388 print("{0}\nShall '{1}' be installed using pip? (Y/n)" |
1388 print("{0}\nShall '{1}' be installed using pip? (Y/n)" |
1389 .format(message, packageName), end=" ") |
1389 .format(message, packageName), end=" ") |
1390 answer = input() # secok |
1390 answer = input() # secok |
1391 if answer in ("", "Y", "y"): |
1391 if answer in ("", "Y", "y"): |
1392 exitCode = subprocess.call( # secok |
1392 exitCode = subprocess.run( # secok |
1393 [sys.executable, "-m", "pip", "install", "--prefer-binary", |
1393 [sys.executable, "-m", "pip", "install", "--prefer-binary", |
1394 "--upgrade", packageName] |
1394 "--upgrade", packageName] |
1395 ) |
1395 ).returncode |
1396 ok = (exitCode == 0) |
1396 ok = (exitCode == 0) |
1397 |
1397 |
1398 return ok |
1398 return ok |
1399 |
1399 |
1400 |
1400 |
1404 |
1404 |
1405 @return flag indicating an outdated pip |
1405 @return flag indicating an outdated pip |
1406 @rtype bool |
1406 @rtype bool |
1407 """ |
1407 """ |
1408 try: |
1408 try: |
1409 pipOut = subprocess.check_output([ # secok |
1409 pipOut = subprocess.run( # secok |
1410 sys.executable, "-m", "pip", "list", "--outdated", |
1410 [sys.executable, "-m", "pip", "list", "--outdated", |
1411 "--format=json" |
1411 "--format=json"], |
1412 ]) |
1412 check=True, capture_output=True, text=True |
1413 pipOut = pipOut.decode() |
1413 ).stdout |
1414 except (OSError, subprocess.CalledProcessError): |
1414 except (OSError, subprocess.CalledProcessError): |
1415 pipOut = "[]" # default empty list |
1415 pipOut = "[]" # default empty list |
1416 try: |
1416 try: |
1417 jsonList = json.loads(pipOut) |
1417 jsonList = json.loads(pipOut) |
1418 except Exception: |
1418 except Exception: |
1437 answer = "y" |
1437 answer = "y" |
1438 else: |
1438 else: |
1439 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") |
1439 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") |
1440 answer = input() # secok |
1440 answer = input() # secok |
1441 if answer in ("", "Y", "y"): |
1441 if answer in ("", "Y", "y"): |
1442 subprocess.call( # secok |
1442 subprocess.run( # secok |
1443 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"]) |
1443 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"]) |
1444 |
1444 |
1445 |
1445 |
1446 def versionToStr(version): |
1446 def versionToStr(version): |
1447 """ |
1447 """ |
1795 if sys.platform.startswith(("win", "cygwin")) else |
1795 if sys.platform.startswith(("win", "cygwin")) else |
1796 os.path.join(sys.exec_prefix, "bin", "hg") |
1796 os.path.join(sys.exec_prefix, "bin", "hg") |
1797 ) |
1797 ) |
1798 for hg in (localHg, "hg"): |
1798 for hg in (localHg, "hg"): |
1799 with contextlib.suppress(OSError, subprocess.CalledProcessError): |
1799 with contextlib.suppress(OSError, subprocess.CalledProcessError): |
1800 hgOut = subprocess.check_output([hg, "identify", "-i"]) # secok |
1800 hgOut = subprocess.run( # secok |
1801 hgOut = hgOut.decode() |
1801 [hg, "identify", "-i"], check=True, |
|
1802 capture_output=True, text=True |
|
1803 ).stdout |
1802 if hgOut: |
1804 if hgOut: |
1803 break |
1805 break |
1804 else: |
1806 else: |
1805 hgOut = "" |
1807 hgOut = "" |
1806 if hgOut: |
1808 if hgOut: |