Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c1cee9

Browse files
committed
Replaces use of WinRAR to generate ZIP file with Python script
1 parent 88abdef commit 8c1cee9

4 files changed

Lines changed: 6 additions & 24 deletions

File tree

Tools/msi/buildrelease.bat

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ for %%f in (%_DLLTOOL_PATH%) do set PATH=%PATH%;%%~dpf
6464
set _DLLTOOL_PATH=
6565
:skipdlltoolsearch
6666

67-
where rar /q && goto skiprarsearch
68-
set _RAR_PATH=
69-
where /R "%ProgramFiles%\WinRAR" rar > "%TEMP%\rar.loc" 2> nul && set /P _RAR_PATH= < "%TEMP%\rar.loc" & del "%TEMP%\rar.loc"
70-
where /R "%ProgramFiles(x86)%\WinRAR" rar > "%TEMP%\rar.loc" 2> nul && set /P _RAR_PATH= < "%TEMP%\rar.loc" & del "%TEMP%\rar.loc"
71-
if not exist "%_RAR_PATH%" echo Cannot find WinRAR on PATH or in external && pause
72-
:skiprarsearch
73-
7467
if defined BUILDX86 (
7568
call :build x86
7669
if errorlevel 1 exit /B
@@ -142,7 +135,7 @@ if errorlevel 1 exit /B
142135
msbuild "%D%bundle\releaseweb.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false
143136
if errorlevel 1 exit /B
144137

145-
if defined _RAR_PATH msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% "/p:RAR=%_RAR_PATH%"
138+
msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS%
146139

147140
if not "%OUTDIR%" EQU "" (
148141
mkdir "%OUTDIR%\%OUTDIR_PLAT%"

Tools/msi/make_zip.proj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<TargetPath>$(OutputPath)\en-us\$(TargetName)$(TargetExt)</TargetPath>
1616
<Arguments>"$(PythonExe)" "$(MSBuildThisFileDirectory)\make_zip.py"</Arguments>
1717
<Arguments>$(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -a $(ArchName)</Arguments>
18-
<Arguments Condition="Exists('$(RAR)')">$(Arguments) --rar "$(RAR)"</Arguments>
1918
<Environment>set DOC_FILENAME=python$(PythonVersion).chm</Environment>
2019
</PropertyGroup>
2120

Tools/msi/make_zip.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def include_in_tools(p):
7272
('python35.zip', 'Lib', '**/*', include_in_lib),
7373
]
7474

75-
def copy_to_layout(target, source, rel_sources):
75+
def copy_to_layout(target, rel_sources):
7676
count = 0
7777

7878
if target.suffix.lower() == '.zip':
@@ -146,21 +146,11 @@ def main():
146146
try:
147147
for t, s, p, c in layout:
148148
s = source / s.replace("$arch", arch)
149-
copied = copy_to_layout(
150-
temp / t.rstrip('/'),
151-
source,
152-
rglob(s, p, c)
153-
)
149+
copied = copy_to_layout(temp / t.rstrip('/'), rglob(s, p, c))
154150
print('Copied {} files'.format(copied))
155151

156-
if rar and rar.is_file():
157-
subprocess.check_call([
158-
str(rar),
159-
"a",
160-
"-ed", "-ep1", "-s", "-r",
161-
str(out),
162-
str(temp / '*')
163-
])
152+
total = copy_to_layout(out, rglob(temp, '*', None))
153+
print('Wrote {} files to {}'.format(total, out))
164154
finally:
165155
if delete_temp:
166156
shutil.rmtree(temp, True)

Tools/msi/uploadrelease.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<File Include="$(OutputPath)\*.msi;$(OutputPath)\*.msu">
2424
<CopyTo>$(MSITarget)</CopyTo>
2525
</File>
26-
<File Include="$(OutputPath)\*.exe">
26+
<File Include="$(OutputPath)\*.exe;$(OutputPath)\*.zip">
2727
<CopyTo>$(EXETarget)</CopyTo>
2828
</File>
2929
<File Include="$(PySourcePath)Doc\build\htmlhelp\python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm" Condition="$(IncludeDoc)">

0 commit comments

Comments
 (0)