return p.suffix.lower() in {'.py', '.pyw', '.txt'}
FULL_LAYOUT = [
- ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug),
- ('/', 'PCBuild/$arch', 'python*.dll', is_not_debug),
+ ('/', 'PCBuild/$arch', 'python.exe', is_not_debug),
+ ('/', 'PCBuild/$arch', 'pythonw.exe', is_not_debug),
+ ('/', 'PCBuild/$arch', 'python{0.major}.dll'.format(sys.version_info), is_not_debug),
+ ('/', 'PCBuild/$arch', 'python{0.major}{0.minor}.dll'.format(sys.version_info), is_not_debug),
('DLLs/', 'PCBuild/$arch', '*.pyd', is_not_debug),
- ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug),
+ ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug_or_python),
('include/', 'include', '*.h', None),
('include/', 'PC', 'pyconfig.h', None),
('Lib/', 'Lib', '**/*', include_in_lib),
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--source', metavar='dir', help='The directory containing the repository root', type=Path)
- parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, required=True)
+ parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, default=None)
parser.add_argument('-t', '--temp', metavar='dir', help='A directory to temporarily extract files into', type=Path, default=None)
parser.add_argument('-e', '--embed', help='Create an embedding layout', action='store_true', default=False)
parser.add_argument('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32")
ns = parser.parse_args()
- source = ns.source or (Path(__file__).parent.parent.parent)
+ source = ns.source or (Path(__file__).resolve().parent.parent.parent)
out = ns.out
arch = ns.arch
assert isinstance(source, Path)
- assert isinstance(out, Path)
+ assert not out or isinstance(out, Path)
assert isinstance(arch, str)
if ns.temp:
temp = Path(tempfile.mkdtemp())
delete_temp = True
- try:
- out.parent.mkdir(parents=True)
- except FileExistsError:
- pass
+ if out:
+ try:
+ out.parent.mkdir(parents=True)
+ except FileExistsError:
+ pass
try:
temp.mkdir(parents=True)
except FileExistsError:
with open(str(temp / 'pyvenv.cfg'), 'w') as f:
print('applocal = true', file=f)
- total = copy_to_layout(out, rglob(temp, '*', None))
- print('Wrote {} files to {}'.format(total, out))
+ if out:
+ total = copy_to_layout(out, rglob(temp, '**/*', None))
+ print('Wrote {} files to {}'.format(total, out))
finally:
if delete_temp:
shutil.rmtree(temp, True)
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{10487945-15D1-4092-A214-338395C4116B}</ProjectGuid>
+ <OutputName>python</OutputName>
+ <OutputName Condition="$(Platform) == 'x86'">$(OutputName)x86</OutputName>
+ <OutputSuffix></OutputSuffix>
+ <SupportSigning>false</SupportSigning>
+ </PropertyGroup>
+
+ <Import Project="..\msi\msi.props" />
+
+ <PropertyGroup>
+ <Nuget Condition="$(Nuget) == ''">$(ExternalsDir)\windows-installer\nuget\nuget.exe</Nuget>
+ <NuspecVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</NuspecVersion>
+ <SignOutput>false</SignOutput>
+ <TargetName>$(OutputName).$(NuspecVersion)</TargetName>
+ <TargetExt>.nupkg</TargetExt>
+ <TargetPath>$(OutputPath)\en-us\$(TargetName)$(TargetExt)</TargetPath>
+ <IntermediateOutputPath>$(IntermediateOutputPath)\nuget_$(ArchName)</IntermediateOutputPath>
+
+ <CleanCommand>rmdir /q/s "$(IntermediateOutputPath)"</CleanCommand>
+
+ <PythonArguments>"$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py"</PythonArguments>
+ <PythonArguments>$(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName)</PythonArguments>
+
+ <NugetArguments>"$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec"</NugetArguments>
+ <NugetArguments>$(NugetArguments) -BasePath "$(IntermediateOutputPath)"</NugetArguments>
+ <NugetArguments>$(NugetArguments) -OutputDirectory "$(OutputPath)\en-us"</NugetArguments>
+ <NugetArguments>$(NugetArguments) -Version "$(NuspecVersion)"</NugetArguments>
+ <NugetArguments>$(NugetArguments) -NoPackageAnalysis -NonInteractive</NugetArguments>
+
+ <Environment>setlocal
+set DOC_FILENAME=python$(PythonVersion).chm
+set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT</Environment>
+ </PropertyGroup>
+
+ <Target Name="_NugetMissing" BeforeTargets="_Build" Condition="!Exists($(Nuget))">
+ <Error Text="$(Nuget) could not be found. Either avoid specifying the property or update your externals/windows-installer files." />
+ </Target>
+
+ <Target Name="_Build">
+ <Exec Command="$(Environment)
+$(CleanCommand)
+$(PythonArguments)" />
+ <Exec Command="$(NugetArguments)" />
+ </Target>
+
+ <Target Name="AfterBuild" />
+ <Target Name="Build" DependsOnTargets="_Build;AfterBuild" />
+</Project>