10800:c6ce5522be30 | 10801:5859861e7a1f |
---|---|
33 distDir = None | 33 distDir = None |
34 installPackage = "eric7" | 34 installPackage = "eric7" |
35 doCleanup = True | 35 doCleanup = True |
36 doCompile = True | 36 doCompile = True |
37 doDepChecks = True | 37 doDepChecks = True |
38 proxy = None | |
38 sourceDir = "eric" | 39 sourceDir = "eric" |
39 eric7SourceDir = "" | 40 eric7SourceDir = "" |
40 | 41 |
41 | 42 |
42 def exit(rcode=0): | 43 def exit(rcode=0): |
293 without asking the user | 294 without asking the user |
294 @type bool | 295 @type bool |
295 @return flag indicating a successful installation | 296 @return flag indicating a successful installation |
296 @rtype bool | 297 @rtype bool |
297 """ | 298 """ |
299 global proxy | |
300 | |
298 ok = False | 301 ok = False |
299 if force: | 302 if force: |
300 answer = "y" | 303 answer = "y" |
301 else: | 304 else: |
302 print( | 305 print( |
305 ), | 308 ), |
306 end=" ", | 309 end=" ", |
307 ) | 310 ) |
308 answer = input() # secok | 311 answer = input() # secok |
309 if answer in ("", "Y", "y"): | 312 if answer in ("", "Y", "y"): |
310 exitCode = subprocess.run( # secok | 313 args = [ |
311 [ | 314 sys.executable, |
312 sys.executable, | 315 "-m", |
313 "-m", | 316 "pip", |
314 "pip", | 317 "install", |
315 "install", | 318 "--prefer-binary", |
316 "--prefer-binary", | 319 "--upgrade", |
317 "--upgrade", | 320 ] |
318 packageName, | 321 if proxy: |
319 ] | 322 args.append(f"--proxy={proxy}") |
320 ).returncode | 323 args.append(packageName) |
324 exitCode = subprocess.run(args).returncode # secok | |
321 ok = exitCode == 0 | 325 ok = exitCode == 0 |
322 | 326 |
323 return ok | 327 return ok |
324 | 328 |
325 | 329 |
328 Check, if pip is outdated. | 332 Check, if pip is outdated. |
329 | 333 |
330 @return flag indicating an outdated pip | 334 @return flag indicating an outdated pip |
331 @rtype bool | 335 @rtype bool |
332 """ | 336 """ |
333 try: | 337 global proxy |
338 | |
339 try: | |
340 args = [ | |
341 sys.executable, | |
342 "-m", | |
343 "pip", | |
344 "list", | |
345 "--outdated", | |
346 "--format=json", | |
347 ] | |
348 if proxy: | |
349 args.append(f"--proxy={proxy}") | |
334 pipOut = ( | 350 pipOut = ( |
335 subprocess.run( # secok | 351 subprocess.run( # secok |
336 [sys.executable, "-m", "pip", "list", "--outdated", "--format=json"], | 352 args, |
337 check=True, | 353 check=True, |
338 capture_output=True, | 354 capture_output=True, |
339 text=True, | 355 text=True, |
340 ) | 356 ) |
341 .stdout.strip() | 357 .stdout.strip() |
362 | 378 |
363 def updatePip(): | 379 def updatePip(): |
364 """ | 380 """ |
365 Update the installed pip package. | 381 Update the installed pip package. |
366 """ | 382 """ |
367 global yes2All | 383 global proxy |
368 | 384 |
369 if yes2All: | 385 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") |
370 answer = "y" | 386 answer = input() # secok |
371 else: | |
372 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") | |
373 answer = input() # secok | |
374 if answer in ("", "Y", "y"): | 387 if answer in ("", "Y", "y"): |
375 subprocess.run( # secok | 388 args = [ |
376 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"] | 389 sys.executable, |
377 ) | 390 "-m", |
391 "pip", | |
392 "install", | |
393 "--upgrade", | |
394 ] | |
395 if proxy: | |
396 args.append(f"--proxy={proxy}") | |
397 args.append("pip") | |
398 subprocess.run(args) # secok | |
378 | 399 |
379 | 400 |
380 def doDependancyChecks(): | 401 def doDependancyChecks(): |
381 """ | 402 """ |
382 Perform some dependency checks. | 403 Perform some dependency checks. |
542 parser.add_argument( | 563 parser.add_argument( |
543 "-x", | 564 "-x", |
544 action="store_false", | 565 action="store_false", |
545 help="don't perform dependency checks (use on your own risk)", | 566 help="don't perform dependency checks (use on your own risk)", |
546 ) | 567 ) |
568 parser.add_argument( | |
569 "--proxy", | |
570 default=None, | |
571 metavar="url", | |
572 help="HTTP proxy url will be used with pip (default: no proxy used)", | |
573 ) | |
547 | 574 |
548 return parser | 575 return parser |
549 | 576 |
550 | 577 |
551 def main(argv): | 578 def main(argv): |
553 The main function of the script. | 580 The main function of the script. |
554 | 581 |
555 @param argv the list of command line arguments | 582 @param argv the list of command line arguments |
556 @type list of str | 583 @type list of str |
557 """ | 584 """ |
558 global modDir, doCleanup, doCompile, doDepChecks, distDir, scriptsDir | 585 global modDir, doCleanup, doCompile, doDepChecks, distDir, scriptsDir, proxy |
559 global sourceDir, eric7SourceDir | 586 global sourceDir, eric7SourceDir |
560 | 587 |
561 if sys.version_info < (3, 8, 0) or sys.version_info >= (4, 0, 0): | 588 if sys.version_info < (3, 8, 0) or sys.version_info >= (4, 0, 0): |
562 print("Sorry, the eric debugger requires Python 3.8 or better for running.") | 589 print("Sorry, the eric-ide serverr requires Python 3.8 or better for running.") |
563 exit(5) | 590 exit(5) |
564 | 591 |
565 if os.path.dirname(argv[0]): | 592 if os.path.dirname(argv[0]): |
566 os.chdir(os.path.dirname(argv[0])) | 593 os.chdir(os.path.dirname(argv[0])) |
567 | 594 |
573 modDir = args.d | 600 modDir = args.d |
574 scriptsDir = args.b | 601 scriptsDir = args.b |
575 doDepChecks = args.x | 602 doDepChecks = args.x |
576 doCleanup = args.c | 603 doCleanup = args.c |
577 doCompile = args.z | 604 doCompile = args.z |
605 proxy = args.proxy | |
578 if not sys.platform.startswith(("win", "cygwin")) and args.i: | 606 if not sys.platform.startswith(("win", "cygwin")) and args.i: |
579 distDir = os.path.normpath(args.i) | 607 distDir = os.path.normpath(args.i) |
580 | 608 |
581 # check dependencies | 609 # check dependencies |
582 if doDepChecks: | 610 if doDepChecks: |