@@ -41,26 +41,6 @@ def get_drives():
41
41
return drives
42
42
43
43
44
- def get_nsis_exe ():
45
- """Return NSIS executable"""
46
- localdir = str (Path (sys .prefix ).parent .parent )
47
- for drive in get_drives ():
48
- for dirname in (
49
- r"C:\Program Files" ,
50
- r"C:\Program Files (x86)" ,
51
- drive + r"PortableApps\NSISPortableANSI" ,
52
- drive + r"PortableApps\NSISPortable" ,
53
- str (Path (localdir ) / "NSISPortableANSI" ),
54
- str (Path (localdir ) / "NSISPortable" ),
55
- ):
56
- for subdirname in ("." , "App" ):
57
- exe = str (Path (dirname ) / subdirname / "NSIS" / "makensis.exe" )
58
- if Path (exe ).is_file ():
59
- return exe
60
- else :
61
- raise RuntimeError ("NSIS is not installed on this computer." )
62
-
63
-
64
44
def get_7zip_exe ():
65
45
"""Return 7zip executable"""
66
46
localdir = str (Path (sys .prefix ).parent .parent )
@@ -78,27 +58,6 @@ def get_7zip_exe():
78
58
raise RuntimeError ("7ZIP is not installed on this computer." )
79
59
80
60
81
- def replace_in_nsis_file (fname , data ):
82
- """Replace text in line starting with *start*, from this position:
83
- data is a list of (start, text) tuples"""
84
- fd = open (fname , "U" )
85
- lines = fd .readlines ()
86
- fd .close ()
87
- for idx , line in enumerate (lines ):
88
- for start , text in data :
89
- if start not in (
90
- "Icon" ,
91
- "OutFile" ,
92
- ) and not start .startswith ("!" ):
93
- start = "!define " + start
94
- if line .startswith (start + " " ):
95
- lines [idx ] = line [: len (start ) + 1 ] + f'"{ text } "' + "\n "
96
- fd = open (fname , "w" )
97
- fd .writelines (lines )
98
- print ("iss for " , fname , "is" , lines )
99
- fd .close ()
100
-
101
-
102
61
def replace_in_7zip_file (fname , data ):
103
62
"""Replace text in line starting with *start*, from this position:
104
63
data is a list of (start, text) tuples"""
@@ -120,35 +79,6 @@ def replace_in_7zip_file(fname, data):
120
79
fd .close ()
121
80
122
81
123
- def build_nsis (srcname , dstname , data ):
124
- """Build NSIS script"""
125
- NSIS_EXE = get_nsis_exe () # NSIS Compiler
126
- portable_dir = str (Path (__file__ ).resolve ().parent / "portable" )
127
- shutil .copy (str (Path (portable_dir ) / srcname ), dstname )
128
- data = [
129
- (
130
- "!addincludedir" ,
131
- str (Path (portable_dir ) / "include" ),
132
- )
133
- ] + list (data )
134
- replace_in_nsis_file (dstname , data )
135
- try :
136
- retcode = subprocess .call (
137
- f'"{ NSIS_EXE } " -V2 "{ dstname } "' ,
138
- shell = True ,
139
- stdout = sys .stderr ,
140
- )
141
- if retcode < 0 :
142
- print (
143
- "Child was terminated by signal" ,
144
- - retcode ,
145
- file = sys .stderr ,
146
- )
147
- except OSError as e :
148
- print ("Execution failed:" , e , file = sys .stderr )
149
- os .remove (dstname )
150
-
151
-
152
82
def build_shimmy_launcher (launcher_name , command , icon_path , mkshim_program = 'mkshim400.py' , workdir = '' ):
153
83
"""Build .exe launcher with mkshim_program and pywin32"""
154
84
@@ -449,44 +379,6 @@ def create_launcher_shimmy(
449
379
true_command = command .replace (r"$SYSDIR\cmd.exe" ,"cmd.exe" )+ " " + args
450
380
build_shimmy_launcher (iconlauncherfullname , true_command , icon_fname , mkshim_program = mkshim_program , workdir = workdir )
451
381
452
- def create_launcher (
453
- self ,
454
- name ,
455
- icon ,
456
- command = None ,
457
- args = None ,
458
- workdir = r"$EXEDIR\scripts" ,
459
- launcher = "launcher_basic.nsi" ,
460
- ):
461
- """Create exe launcher with NSIS"""
462
- assert name .endswith (".exe" )
463
- portable_dir = str (Path (__file__ ).resolve ().parent / "portable" )
464
- icon_fname = str (Path (portable_dir ) / "icons" / icon )
465
- assert Path (icon_fname ).is_file ()
466
-
467
- # Customizing NSIS script
468
- if command is None :
469
- if args is not None and ".pyw" in args :
470
- command = "${WINPYDIR}\pythonw.exe"
471
- else :
472
- command = "${WINPYDIR}\python.exe"
473
- if args is None :
474
- args = ""
475
- if workdir is None :
476
- workdir = ""
477
- fname = str (Path (self .winpydir ) / (Path (name ).stem + ".nsi" ))
478
-
479
- data = [
480
- ("WINPYDIR" , f"$EXEDIR\{ self .python_name } " ),
481
- ("WINPYVER" , self .winpyver ),
482
- ("COMMAND" , command ),
483
- ("PARAMETERS" , args ),
484
- ("WORKDIR" , workdir ),
485
- ("Icon" , icon_fname ),
486
- ("OutFile" , name ),
487
- ]
488
-
489
- build_nsis (launcher , fname , data )
490
382
491
383
def create_python_batch (
492
384
self ,
@@ -1495,10 +1387,8 @@ def make(
1495
1387
# self._add_msvc_files() # replaced per msvc_runtime package
1496
1388
self ._create_batch_scripts_initial ()
1497
1389
self ._create_batch_scripts ()
1498
- # always create all launchers (as long as it is NSIS -based)
1390
+ # always create all launchers (as long as it is not shimmy -based, to see for after )
1499
1391
self ._create_launchers ()
1500
- # pre-patch current pip (until default python has pip 8.0.3)
1501
-
1502
1392
# PyPY must ensure pip
1503
1393
# "pypy3.exe -m ensurepip"
1504
1394
utils .python_execmodule ("ensurepip" , self .distribution .target )
@@ -1531,9 +1421,6 @@ def make(
1531
1421
print (f"piping { ' ' .join (actions )} " )
1532
1422
self ._print (f"piping { ' ' .join (actions )} " )
1533
1423
self .distribution .do_pip_action (actions )
1534
- # actions=["install","-r", req, "--no-index",
1535
- # "--trusted-host=None"]+ links,
1536
- # install_options=None)
1537
1424
self ._run_complement_batch_scripts ()
1538
1425
self .distribution .patch_standard_packages ()
1539
1426
if remove_existing and not self .simulation :
0 commit comments