From 33128c815e8e7e35ab913e9eb176cf14842ea962 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 27 Jun 2016 09:34:18 -0700 Subject: Include libs folder in nuget package and allow preinstalling packages --- Tools/msi/make_zip.py | 34 +++++++++++++++++++++++++--------- Tools/nuget/make_pkg.proj | 6 ++++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py index 2fb40d1..de978ba 100644 --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -12,9 +12,19 @@ from zipfile import ZipFile, ZIP_DEFLATED import subprocess TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE) -DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe)$', re.IGNORECASE) +DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe|pdb|lib)$', re.IGNORECASE) PYTHON_DLL_RE = re.compile(r'python\d\d?\.dll$', re.IGNORECASE) +DEBUG_FILES = { + '_ctypes_test', + '_testbuffer', + '_testcapi', + '_testimportmultiple', + '_testmultiphase', + 'xxlimited', + 'python3_dstub', +} + EXCLUDE_FROM_LIBRARY = { '__pycache__', 'ensurepip', @@ -30,6 +40,12 @@ EXCLUDE_FILE_FROM_LIBRARY = { 'bdist_wininst.py', } +EXCLUDE_FILE_FROM_LIBS = { + 'ssleay', + 'libeay', + 'python3stub', +} + def is_not_debug(p): if DEBUG_RE.search(p.name): return False @@ -37,14 +53,7 @@ def is_not_debug(p): if TKTCL_RE.search(p.name): return False - return p.name.lower() not in { - '_ctypes_test.pyd', - '_testbuffer.pyd', - '_testcapi.pyd', - '_testimportmultiple.pyd', - '_testmultiphase.pyd', - 'xxlimited.pyd', - } + return p.stem.lower() not in DEBUG_FILES def is_not_debug_or_python(p): return is_not_debug(p) and not PYTHON_DLL_RE.search(p.name) @@ -68,6 +77,12 @@ def include_in_lib(p): suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_libs(p): + if not is_not_debug(p): + return False + + return p.stem.lower() not in EXCLUDE_FILE_FROM_LIBS + def include_in_tools(p): if p.is_dir() and p.name.lower() in {'scripts', 'i18n', 'pynche', 'demo', 'parser'}: return True @@ -84,6 +99,7 @@ FULL_LAYOUT = [ ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), + ('libs/', 'PCBuild/$arch', '*.lib', include_in_libs), ('Tools/', 'Tools', '**/*', include_in_tools), ] diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj index bd3fad8..542bf07 100644 --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -17,7 +17,7 @@ false $(OutputName).$(NuspecVersion) .nupkg - $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(OutputPath)\$(TargetName)$(TargetExt) $(IntermediateOutputPath)\nuget_$(ArchName) rmdir /q/s "$(IntermediateOutputPath)" @@ -26,10 +26,11 @@ $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" - $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" + $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" $(NugetArguments) -Version "$(NuspecVersion)" $(NugetArguments) -NoPackageAnalysis -NonInteractive @@ -47,6 +48,7 @@ set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140. + -- cgit v0.12