mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-05 12:12:28 +00:00
python-3.6.zip added from Github
README.cosmo contains the necessary links.
This commit is contained in:
parent
75fc601ff5
commit
0c4c56ff39
4219 changed files with 1968626 additions and 0 deletions
BIN
third_party/python/PC/bdist_wininst/PythonPowered.bmp
vendored
Normal file
BIN
third_party/python/PC/bdist_wininst/PythonPowered.bmp
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
5
third_party/python/PC/bdist_wininst/README.txt
vendored
Normal file
5
third_party/python/PC/bdist_wininst/README.txt
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
XXX Write description
|
||||
XXX Dont't forget to mention upx
|
||||
|
||||
XXX Add pointer to this file into PC/README.txt
|
104
third_party/python/PC/bdist_wininst/archive.h
vendored
Normal file
104
third_party/python/PC/bdist_wininst/archive.h
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* zip-archive headers
|
||||
* See: http://www.pkware.com/appnote.html
|
||||
*/
|
||||
|
||||
struct eof_cdir {
|
||||
long tag; /* must be 0x06054b50 */
|
||||
short disknum;
|
||||
short firstdisk;
|
||||
short nTotalCDirThis;
|
||||
short nTotalCDir;
|
||||
long nBytesCDir;
|
||||
long ofsCDir;
|
||||
short commentlen;
|
||||
};
|
||||
|
||||
struct cdir {
|
||||
long tag; /* must be 0x02014b50 */
|
||||
short version_made;
|
||||
short version_extract;
|
||||
short gp_bitflag;
|
||||
short comp_method;
|
||||
short last_mod_file_time;
|
||||
short last_mod_file_date;
|
||||
long crc32;
|
||||
long comp_size;
|
||||
long uncomp_size;
|
||||
short fname_length;
|
||||
short extra_length;
|
||||
short comment_length;
|
||||
short disknum_start;
|
||||
short int_file_attr;
|
||||
long ext_file_attr;
|
||||
long ofs_local_header;
|
||||
};
|
||||
|
||||
struct fhdr {
|
||||
long tag; /* must be 0x04034b50 */
|
||||
short version_needed;
|
||||
short flags;
|
||||
short method;
|
||||
short last_mod_file_time;
|
||||
short last_mod_file_date;
|
||||
long crc32;
|
||||
long comp_size;
|
||||
long uncomp_size;
|
||||
short fname_length;
|
||||
short extra_length;
|
||||
};
|
||||
|
||||
|
||||
struct meta_data_hdr {
|
||||
int tag;
|
||||
int uncomp_size;
|
||||
int bitmap_size;
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* installation scheme */
|
||||
|
||||
typedef struct tagSCHEME {
|
||||
char *name;
|
||||
char *prefix;
|
||||
} SCHEME;
|
||||
|
||||
typedef int (*NOTIFYPROC)(int code, LPSTR text, ...);
|
||||
|
||||
extern BOOL
|
||||
extract_file(char *dst, char *src, int method, int comp_size,
|
||||
int uncomp_size, NOTIFYPROC notify);
|
||||
|
||||
extern BOOL
|
||||
unzip_archive(SCHEME *scheme, char *dirname, char *data,
|
||||
DWORD size, NOTIFYPROC notify);
|
||||
|
||||
extern char *
|
||||
map_new_file(DWORD flags, char *filename, char
|
||||
*pathname_part, int size,
|
||||
WORD wFatDate, WORD wFatTime,
|
||||
NOTIFYPROC callback);
|
||||
|
||||
extern BOOL
|
||||
ensure_directory (char *pathname, char *new_part,
|
||||
NOTIFYPROC callback);
|
||||
|
||||
/* codes for NOITIFYPROC */
|
||||
#define DIR_CREATED 1
|
||||
#define CAN_OVERWRITE 2
|
||||
#define FILE_CREATED 3
|
||||
#define ZLIB_ERROR 4
|
||||
#define SYSTEM_ERROR 5
|
||||
#define NUM_FILES 6
|
||||
#define FILE_OVERWRITTEN 7
|
||||
|
108
third_party/python/PC/bdist_wininst/bdist_wininst.vcxproj
vendored
Normal file
108
third_party/python/PC/bdist_wininst/bdist_wininst.vcxproj
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGInstrument|Win32">
|
||||
<Configuration>PGInstrument</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGInstrument|x64">
|
||||
<Configuration>PGInstrument</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGUpdate|Win32">
|
||||
<Configuration>PGUpdate</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGUpdate|x64">
|
||||
<Configuration>PGUpdate</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}</ProjectGuid>
|
||||
<RootNamespace>wininst</RootNamespace>
|
||||
<SupportPGO>false</SupportPGO>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\PCBuild\python.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\PCBuild\pyproject.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir>$(PySourcePath)lib\distutils\command\</OutDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>wininst-$(VisualStudioVersion)</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v140'">wininst-14.0</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v120'">wininst-12.0</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v110'">wininst-11.0</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v100'">wininst-10.0</TargetName>
|
||||
<TargetName Condition="$(Platform) == 'x64'">$(TargetName)-amd64</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Midl>
|
||||
<TypeLibraryName>$(OutDir)wininst.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<AdditionalIncludeDirectories>$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>comctl32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="extract.c" />
|
||||
<ClCompile Include="install.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\adler32.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\crc32.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\inffast.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\inflate.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\inftrees.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\zutil.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="archive.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="install.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PythonPowered.bmp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
61
third_party/python/PC/bdist_wininst/bdist_wininst.vcxproj.filters
vendored
Normal file
61
third_party/python/PC/bdist_wininst/bdist_wininst.vcxproj.filters
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{293b1092-03ad-4b7c-acb9-c4ab62e52f55}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\zlib">
|
||||
<UniqueIdentifier>{0edc0406-282f-4dbc-b60e-a867c34a2a31}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{ea0c0f0e-3b73-474e-a999-e9689d032ccc}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{0c77c1cf-3f87-4f87-bd86-b425211c2181}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\PC\bdist_wininst\extract.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PC\bdist_wininst\install.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\adler32.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\crc32.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\inffast.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\inflate.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\inftrees.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\zutil.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\PC\bdist_wininst\archive.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\PC\bdist_wininst\install.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\PC\bdist_wininst\PythonPowered.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
19
third_party/python/PC/bdist_wininst/build.bat
vendored
Normal file
19
third_party/python/PC/bdist_wininst/build.bat
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
set D=%~dp0
|
||||
set PCBUILD=%~dp0..\..\PCBuild\
|
||||
|
||||
|
||||
echo Building Lib\distutils\command\wininst-xx.0.exe
|
||||
|
||||
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
|
||||
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
|
||||
|
||||
%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=Win32
|
||||
if errorlevel 1 goto :eof
|
||||
|
||||
|
||||
echo Building Lib\distutils\command\wininst-xx.0-amd64.exe
|
||||
|
||||
%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=x64
|
320
third_party/python/PC/bdist_wininst/extract.c
vendored
Normal file
320
third_party/python/PC/bdist_wininst/extract.c
vendored
Normal file
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "archive.h"
|
||||
|
||||
/* Convert unix-path to dos-path */
|
||||
static void normpath(char *path)
|
||||
{
|
||||
while (path && *path) {
|
||||
if (*path == '/')
|
||||
*path = '\\';
|
||||
++path;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL ensure_directory(char *pathname, char *new_part, NOTIFYPROC notify)
|
||||
{
|
||||
while (new_part && *new_part && (new_part = strchr(new_part, '\\'))) {
|
||||
DWORD attr;
|
||||
*new_part = '\0';
|
||||
attr = GetFileAttributes(pathname);
|
||||
if (attr == -1) {
|
||||
/* nothing found */
|
||||
if (!CreateDirectory(pathname, NULL) && notify)
|
||||
notify(SYSTEM_ERROR,
|
||||
"CreateDirectory (%s)", pathname);
|
||||
else
|
||||
notify(DIR_CREATED, pathname);
|
||||
}
|
||||
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
;
|
||||
} else {
|
||||
SetLastError(183);
|
||||
if (notify)
|
||||
notify(SYSTEM_ERROR,
|
||||
"CreateDirectory (%s)", pathname);
|
||||
}
|
||||
*new_part = '\\';
|
||||
++new_part;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* XXX Should better explicitly specify
|
||||
* uncomp_size and file_times instead of pfhdr!
|
||||
*/
|
||||
char *map_new_file(DWORD flags, char *filename,
|
||||
char *pathname_part, int size,
|
||||
WORD wFatDate, WORD wFatTime,
|
||||
NOTIFYPROC notify)
|
||||
{
|
||||
HANDLE hFile, hFileMapping;
|
||||
char *dst;
|
||||
FILETIME ft;
|
||||
|
||||
try_again:
|
||||
if (!flags)
|
||||
flags = CREATE_NEW;
|
||||
hFile = CreateFile(filename,
|
||||
GENERIC_WRITE | GENERIC_READ,
|
||||
0, NULL,
|
||||
flags,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
DWORD x = GetLastError();
|
||||
switch (x) {
|
||||
case ERROR_FILE_EXISTS:
|
||||
if (notify && notify(CAN_OVERWRITE, filename))
|
||||
hFile = CreateFile(filename,
|
||||
GENERIC_WRITE|GENERIC_READ,
|
||||
0, NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
else {
|
||||
if (notify)
|
||||
notify(FILE_OVERWRITTEN, filename);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
if (ensure_directory(filename, pathname_part, notify))
|
||||
goto try_again;
|
||||
else
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
SetLastError(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
if (notify)
|
||||
notify (SYSTEM_ERROR, "CreateFile (%s)", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (notify)
|
||||
notify(FILE_CREATED, filename);
|
||||
|
||||
DosDateTimeToFileTime(wFatDate, wFatTime, &ft);
|
||||
SetFileTime(hFile, &ft, &ft, &ft);
|
||||
|
||||
|
||||
if (size == 0) {
|
||||
/* We cannot map a zero-length file (Also it makes
|
||||
no sense */
|
||||
CloseHandle(hFile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hFileMapping = CreateFileMapping(hFile,
|
||||
NULL, PAGE_READWRITE, 0, size, NULL);
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (hFileMapping == NULL) {
|
||||
if (notify)
|
||||
notify(SYSTEM_ERROR,
|
||||
"CreateFileMapping (%s)", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dst = MapViewOfFile(hFileMapping,
|
||||
FILE_MAP_WRITE, 0, 0, 0);
|
||||
|
||||
CloseHandle(hFileMapping);
|
||||
|
||||
if (!dst) {
|
||||
if (notify)
|
||||
notify(SYSTEM_ERROR, "MapViewOfFile (%s)", filename);
|
||||
return NULL;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
extract_file(char *dst, char *src, int method, int comp_size,
|
||||
int uncomp_size, NOTIFYPROC notify)
|
||||
{
|
||||
z_stream zstream;
|
||||
int result;
|
||||
|
||||
if (method == Z_DEFLATED) {
|
||||
int x;
|
||||
memset(&zstream, 0, sizeof(zstream));
|
||||
zstream.next_in = src;
|
||||
zstream.avail_in = comp_size+1;
|
||||
zstream.next_out = dst;
|
||||
zstream.avail_out = uncomp_size;
|
||||
|
||||
/* Apparently an undocumented feature of zlib: Set windowsize
|
||||
to negative values to suppress the gzip header and be compatible with
|
||||
zip! */
|
||||
result = TRUE;
|
||||
if (Z_OK != (x = inflateInit2(&zstream, -15))) {
|
||||
if (notify)
|
||||
notify(ZLIB_ERROR,
|
||||
"inflateInit2 returns %d", x);
|
||||
result = FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
if (Z_STREAM_END != (x = inflate(&zstream, Z_FINISH))) {
|
||||
if (notify)
|
||||
notify(ZLIB_ERROR,
|
||||
"inflate returns %d", x);
|
||||
result = FALSE;
|
||||
}
|
||||
cleanup:
|
||||
if (Z_OK != (x = inflateEnd(&zstream))) {
|
||||
if (notify)
|
||||
notify (ZLIB_ERROR,
|
||||
"inflateEnd returns %d", x);
|
||||
result = FALSE;
|
||||
}
|
||||
} else if (method == 0) {
|
||||
memcpy(dst, src, uncomp_size);
|
||||
result = TRUE;
|
||||
} else
|
||||
result = FALSE;
|
||||
UnmapViewOfFile(dst);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Open a zip-compatible archive and extract all files
|
||||
* into the specified directory (which is assumed to exist)
|
||||
*/
|
||||
BOOL
|
||||
unzip_archive(SCHEME *scheme, char *dirname, char *data, DWORD size,
|
||||
NOTIFYPROC notify)
|
||||
{
|
||||
int n;
|
||||
char pathname[MAX_PATH];
|
||||
char *new_part;
|
||||
|
||||
/* read the end of central directory record */
|
||||
struct eof_cdir *pe = (struct eof_cdir *)&data[size - sizeof
|
||||
(struct eof_cdir)];
|
||||
|
||||
int arc_start = size - sizeof (struct eof_cdir) - pe->nBytesCDir -
|
||||
pe->ofsCDir;
|
||||
|
||||
/* set position to start of central directory */
|
||||
int pos = arc_start + pe->ofsCDir;
|
||||
|
||||
/* make sure this is a zip file */
|
||||
if (pe->tag != 0x06054b50)
|
||||
return FALSE;
|
||||
|
||||
/* Loop through the central directory, reading all entries */
|
||||
for (n = 0; n < pe->nTotalCDir; ++n) {
|
||||
int i;
|
||||
char *fname;
|
||||
char *pcomp;
|
||||
char *dst;
|
||||
struct cdir *pcdir;
|
||||
struct fhdr *pfhdr;
|
||||
|
||||
pcdir = (struct cdir *)&data[pos];
|
||||
pfhdr = (struct fhdr *)&data[pcdir->ofs_local_header +
|
||||
arc_start];
|
||||
|
||||
if (pcdir->tag != 0x02014b50)
|
||||
return FALSE;
|
||||
if (pfhdr->tag != 0x04034b50)
|
||||
return FALSE;
|
||||
pos += sizeof(struct cdir);
|
||||
fname = (char *)&data[pos]; /* This is not null terminated! */
|
||||
pos += pcdir->fname_length + pcdir->extra_length +
|
||||
pcdir->comment_length;
|
||||
|
||||
pcomp = &data[pcdir->ofs_local_header
|
||||
+ sizeof(struct fhdr)
|
||||
+ arc_start
|
||||
+ pfhdr->fname_length
|
||||
+ pfhdr->extra_length];
|
||||
|
||||
/* dirname is the Python home directory (prefix) */
|
||||
strcpy(pathname, dirname);
|
||||
if (pathname[strlen(pathname)-1] != '\\')
|
||||
strcat(pathname, "\\");
|
||||
new_part = &pathname[lstrlen(pathname)];
|
||||
/* we must now match the first part of the pathname
|
||||
* in the archive to a component in the installation
|
||||
* scheme (PURELIB, PLATLIB, HEADERS, SCRIPTS, or DATA)
|
||||
* and replace this part by the one in the scheme to use
|
||||
*/
|
||||
for (i = 0; scheme[i].name; ++i) {
|
||||
if (0 == strnicmp(scheme[i].name, fname,
|
||||
strlen(scheme[i].name))) {
|
||||
char *rest;
|
||||
int len;
|
||||
|
||||
/* length of the replaced part */
|
||||
int namelen = strlen(scheme[i].name);
|
||||
|
||||
strcat(pathname, scheme[i].prefix);
|
||||
|
||||
rest = fname + namelen;
|
||||
len = pfhdr->fname_length - namelen;
|
||||
|
||||
if ((pathname[strlen(pathname)-1] != '\\')
|
||||
&& (pathname[strlen(pathname)-1] != '/'))
|
||||
strcat(pathname, "\\");
|
||||
/* Now that pathname ends with a separator,
|
||||
* we must make sure rest does not start with
|
||||
* an additional one.
|
||||
*/
|
||||
if ((rest[0] == '\\') || (rest[0] == '/')) {
|
||||
++rest;
|
||||
--len;
|
||||
}
|
||||
|
||||
strncat(pathname, rest, len);
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
/* no prefix to replace found, go unchanged */
|
||||
strncat(pathname, fname, pfhdr->fname_length);
|
||||
Done:
|
||||
normpath(pathname);
|
||||
if (pathname[strlen(pathname)-1] != '\\') {
|
||||
/*
|
||||
* The local file header (pfhdr) does not always
|
||||
* contain the compressed and uncompressed sizes of
|
||||
* the data depending on bit 3 of the flags field. So
|
||||
* it seems better to use the data from the central
|
||||
* directory (pcdir).
|
||||
*/
|
||||
dst = map_new_file(0, pathname, new_part,
|
||||
pcdir->uncomp_size,
|
||||
pcdir->last_mod_file_date,
|
||||
pcdir->last_mod_file_time, notify);
|
||||
if (dst) {
|
||||
if (!extract_file(dst, pcomp, pfhdr->method,
|
||||
pcdir->comp_size,
|
||||
pcdir->uncomp_size,
|
||||
notify))
|
||||
return FALSE;
|
||||
} /* else ??? */
|
||||
}
|
||||
if (notify)
|
||||
notify(NUM_FILES, new_part, (int)pe->nTotalCDir,
|
||||
(int)n+1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
2700
third_party/python/PC/bdist_wininst/install.c
vendored
Normal file
2700
third_party/python/PC/bdist_wininst/install.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
77
third_party/python/PC/bdist_wininst/install.rc
vendored
Normal file
77
third_party/python/PC/bdist_wininst/install.rc
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#include <winres.h>
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
#pragma code_page(1252)
|
||||
|
||||
IDB_BITMAP BITMAP DISCARDABLE "PythonPowered.bmp"
|
||||
|
||||
|
||||
IDD_INTRO DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "This Wizard will install %s on your computer. Click Next to continue or Cancel to exit the Setup Wizard.",
|
||||
IDC_TITLE,125,10,247,20,NOT WS_GROUP
|
||||
EDITTEXT IDC_INTRO_TEXT,125,31,247,131,ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
LTEXT "",IDC_BUILD_INFO,125,163,247,8
|
||||
END
|
||||
|
||||
IDD_SELECTPYTHON DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Select python installation to use:",IDC_TITLE,125,10,
|
||||
247,12,NOT WS_GROUP
|
||||
EDITTEXT IDC_PATH,191,136,181,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Python Directory:",IDC_STATIC,125,137,55,8
|
||||
LISTBOX IDC_VERSIONS_LIST,125,24,247,106,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
EDITTEXT IDC_INSTALL_PATH,191,157,181,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
LTEXT "Installation Directory:",IDC_STATIC,125,158,66,8
|
||||
PUSHBUTTON "Find other ...",IDC_OTHERPYTHON,322,7,50,14,NOT
|
||||
WS_VISIBLE
|
||||
END
|
||||
|
||||
IDD_INSTALLFILES DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.",
|
||||
IDC_TITLE,125,10,246,31,NOT WS_GROUP
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,
|
||||
125,157,246,14
|
||||
CTEXT "Installation progress:",IDC_INFO,125,137,246,8
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
END
|
||||
|
||||
IDD_FINISHED DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Click the Finish button to exit the Setup wizard.",
|
||||
IDC_TITLE,125,10,247,31,NOT WS_GROUP
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
EDITTEXT IDC_INFO,125,40,247,131,ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
|
||||
END
|
31
third_party/python/PC/bdist_wininst/resource.h
vendored
Normal file
31
third_party/python/PC/bdist_wininst/resource.h
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#define IDD_DIALOG1 101
|
||||
#define IDB_BITMAP1 103
|
||||
#define IDD_INTRO 107
|
||||
#define IDD_SELECTPYTHON 108
|
||||
#define IDD_INSTALLFILES 109
|
||||
#define IDD_FINISHED 110
|
||||
#define IDB_BITMAP 110
|
||||
#define IDC_EDIT1 1000
|
||||
#define IDC_TITLE 1000
|
||||
#define IDC_START 1001
|
||||
#define IDC_PROGRESS 1003
|
||||
#define IDC_INFO 1004
|
||||
#define IDC_PYTHON15 1006
|
||||
#define IDC_PATH 1007
|
||||
#define IDC_PYTHON16 1008
|
||||
#define IDC_INSTALL_PATH 1008
|
||||
#define IDC_PYTHON20 1009
|
||||
#define IDC_BROWSE 1010
|
||||
#define IDC_INTRO_TEXT 1021
|
||||
#define IDC_VERSIONS_LIST 1022
|
||||
#define IDC_BUILD_INFO 1024
|
||||
#define IDC_BITMAP 1025
|
||||
#define IDC_OTHERPYTHON 1026
|
Loading…
Add table
Add a link
Reference in a new issue