mirror of https://github.com/python/cpython.git
Adds scripts for producing Nuget packages.
This commit is contained in:
parent
a064382925
commit
33f7310c5e
|
@ -75,10 +75,12 @@ def include_in_tools(p):
|
|||
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),
|
||||
|
@ -150,17 +152,17 @@ def rglob(root, pattern, condition):
|
|||
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:
|
||||
|
@ -170,10 +172,11 @@ def main():
|
|||
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:
|
||||
|
@ -190,8 +193,9 @@ def main():
|
|||
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)
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<?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>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>python</id>
|
||||
<title>Python</title>
|
||||
<version>0.0.0.0</version>
|
||||
<authors>Python Software Foundation</authors>
|
||||
<licenseUrl>https://docs.python.org/3/license.html</licenseUrl>
|
||||
<projectUrl>https://www.python.org/</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Installs 64-bit Python for use in build scenarios.</description>
|
||||
<iconUrl>https://www.python.org/static/favicon.ico</iconUrl>
|
||||
<tags>python</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="**\*" target="tools" />
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>pythonx86</id>
|
||||
<title>Python (32-bit)</title>
|
||||
<authors>Python Software Foundation</authors>
|
||||
<version>0.0.0.0</version>
|
||||
<licenseUrl>https://docs.python.org/3/license.html</licenseUrl>
|
||||
<projectUrl>https://www.python.org/</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Installs 32-bit Python for use in build scenarios.</description>
|
||||
<iconUrl>https://www.python.org/static/favicon.ico</iconUrl>
|
||||
<tags>python</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="**\*" target="tools" />
|
||||
</files>
|
||||
</package>
|
Loading…
Reference in New Issue