Save new folder

This commit is contained in:
2025-11-09 10:02:18 +01:00
commit 5c733eac6b
21738 changed files with 4477854 additions and 0 deletions

View File

@ -0,0 +1,16 @@
/* Minimal main program -- everything is loaded from the library. */
#include "Python.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
int WINAPI wWinMain(
HINSTANCE hInstance, /* handle to current instance */
HINSTANCE hPrevInstance, /* handle to previous instance */
LPWSTR lpCmdLine, /* pointer to command line */
int nCmdShow /* show state of window */
)
{
return Py_Main(__argc, __wargv);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
/* Testing module for multi-phase initialization of extension modules (PEP 489)
*/
#include "Python.h"
#ifdef MS_WINDOWS
#include "..\modules\_io\_iomodule.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <fcntl.h>
/* The full definition is in iomodule. We reproduce
enough here to get the handle, which is all we want. */
typedef struct {
PyObject_HEAD
HANDLE handle;
} winconsoleio;
static int execfunc(PyObject *m)
{
return 0;
}
PyModuleDef_Slot testconsole_slots[] = {
{Py_mod_exec, execfunc},
{0, NULL},
};
/*[clinic input]
module _testconsole
_testconsole.write_input
file: object
s: PyBytesObject
Writes UTF-16-LE encoded bytes to the console as if typed by a user.
[clinic start generated code]*/
static PyObject *
_testconsole_write_input_impl(PyObject *module, PyObject *file,
PyBytesObject *s)
/*[clinic end generated code: output=48f9563db34aedb3 input=4c774f2d05770bc6]*/
{
INPUT_RECORD *rec = NULL;
if (!PyWindowsConsoleIO_Check(file)) {
PyErr_SetString(PyExc_TypeError, "expected raw console object");
return NULL;
}
const wchar_t *p = (const wchar_t *)PyBytes_AS_STRING(s);
DWORD size = (DWORD)PyBytes_GET_SIZE(s) / sizeof(wchar_t);
rec = (INPUT_RECORD*)PyMem_Calloc(size, sizeof(INPUT_RECORD));
if (!rec)
goto error;
INPUT_RECORD *prec = rec;
for (DWORD i = 0; i < size; ++i, ++p, ++prec) {
prec->EventType = KEY_EVENT;
prec->Event.KeyEvent.bKeyDown = TRUE;
prec->Event.KeyEvent.wRepeatCount = 1;
prec->Event.KeyEvent.uChar.UnicodeChar = *p;
}
HANDLE hInput = ((winconsoleio*)file)->handle;
DWORD total = 0;
while (total < size) {
DWORD wrote;
if (!WriteConsoleInputW(hInput, &rec[total], (size - total), &wrote)) {
PyErr_SetFromWindowsErr(0);
goto error;
}
total += wrote;
}
PyMem_Free((void*)rec);
Py_RETURN_NONE;
error:
if (rec)
PyMem_Free((void*)rec);
return NULL;
}
/*[clinic input]
_testconsole.read_output
file: object
Reads a str from the console as written to stdout.
[clinic start generated code]*/
static PyObject *
_testconsole_read_output_impl(PyObject *module, PyObject *file)
/*[clinic end generated code: output=876310d81a73e6d2 input=b3521f64b1b558e3]*/
{
Py_RETURN_NONE;
}
#include "clinic\_testconsole.c.h"
PyMethodDef testconsole_methods[] = {
_TESTCONSOLE_WRITE_INPUT_METHODDEF
_TESTCONSOLE_READ_OUTPUT_METHODDEF
{NULL, NULL}
};
static PyModuleDef testconsole_def = {
PyModuleDef_HEAD_INIT, /* m_base */
"_testconsole", /* m_name */
PyDoc_STR("Test module for the Windows console"), /* m_doc */
0, /* m_size */
testconsole_methods, /* m_methods */
testconsole_slots, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit__testconsole(PyObject *spec)
{
return PyModuleDef_Init(&testconsole_def);
}
#endif /* MS_WINDOWS */

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View 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

View 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

View File

@ -0,0 +1,125 @@
<?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|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<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|ARM">
<Configuration>PGInstrument</Configuration>
<Platform>ARM</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|ARM">
<Configuration>PGUpdate</Configuration>
<Platform>ARM</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|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</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>$(zlibDir);%(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="$(zlibDir)\adler32.c" />
<ClCompile Include="$(zlibDir)\crc32.c" />
<ClCompile Include="$(zlibDir)\inffast.c" />
<ClCompile Include="$(zlibDir)\inflate.c" />
<ClCompile Include="$(zlibDir)\inftrees.c" />
<ClCompile Include="$(zlibDir)\zutil.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="archive.h" />
<ClInclude Include="$(zlibDir)\zlib.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>

View File

@ -0,0 +1,67 @@
<?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>
<Filter Include="Header Files\zlib">
<UniqueIdentifier>{d10220c7-69e3-47c5-8d82-c8e0d4d2ac88}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="extract.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="install.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibDir)\adler32.c">
<Filter>Source Files\zlib</Filter>
</ClCompile>
<ClCompile Include="$(zlibDir)\crc32.c">
<Filter>Source Files\zlib</Filter>
</ClCompile>
<ClCompile Include="$(zlibDir)\inffast.c">
<Filter>Source Files\zlib</Filter>
</ClCompile>
<ClCompile Include="$(zlibDir)\inflate.c">
<Filter>Source Files\zlib</Filter>
</ClCompile>
<ClCompile Include="$(zlibDir)\inftrees.c">
<Filter>Source Files\zlib</Filter>
</ClCompile>
<ClCompile Include="$(zlibDir)\zutil.c">
<Filter>Source Files\zlib</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="install.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="archive.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibDir)\zlib.h">
<Filter>Header Files\zlib</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="PythonPowered.bmp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View 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

View 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;
}

File diff suppressed because it is too large Load Diff

View 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

View 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

View File

@ -0,0 +1 @@
<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd"><CustomCapabilities><CustomCapability Name="Microsoft.classicAppCompat_8wekyb3d8bbwe"></CustomCapability></CustomCapabilities><AuthorizedEntities><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity></AuthorizedEntities></CustomCapabilityDescriptor>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,91 @@
/*[clinic input]
preserve
[clinic start generated code]*/
#if defined(MS_WINDOWS)
PyDoc_STRVAR(_testconsole_write_input__doc__,
"write_input($module, /, file, s)\n"
"--\n"
"\n"
"Writes UTF-16-LE encoded bytes to the console as if typed by a user.");
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF \
{"write_input", (PyCFunction)(void(*)(void))_testconsole_write_input, METH_FASTCALL|METH_KEYWORDS, _testconsole_write_input__doc__},
static PyObject *
_testconsole_write_input_impl(PyObject *module, PyObject *file,
PyBytesObject *s);
static PyObject *
_testconsole_write_input(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"file", "s", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "write_input", 0};
PyObject *argsbuf[2];
PyObject *file;
PyBytesObject *s;
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
file = args[0];
if (!PyBytes_Check(args[1])) {
_PyArg_BadArgument("write_input", "argument 's'", "bytes", args[1]);
goto exit;
}
s = (PyBytesObject *)args[1];
return_value = _testconsole_write_input_impl(module, file, s);
exit:
return return_value;
}
#endif /* defined(MS_WINDOWS) */
#if defined(MS_WINDOWS)
PyDoc_STRVAR(_testconsole_read_output__doc__,
"read_output($module, /, file)\n"
"--\n"
"\n"
"Reads a str from the console as written to stdout.");
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF \
{"read_output", (PyCFunction)(void(*)(void))_testconsole_read_output, METH_FASTCALL|METH_KEYWORDS, _testconsole_read_output__doc__},
static PyObject *
_testconsole_read_output_impl(PyObject *module, PyObject *file);
static PyObject *
_testconsole_read_output(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"file", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "read_output", 0};
PyObject *argsbuf[1];
PyObject *file;
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
file = args[0];
return_value = _testconsole_read_output_impl(module, file);
exit:
return return_value;
}
#endif /* defined(MS_WINDOWS) */
#ifndef _TESTCONSOLE_WRITE_INPUT_METHODDEF
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF
#endif /* !defined(_TESTCONSOLE_WRITE_INPUT_METHODDEF) */
#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF
#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
/*[clinic end generated code: output=dd8b093a91b62753 input=a9049054013a1b77]*/

View File

@ -0,0 +1,682 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(msvcrt_heapmin__doc__,
"heapmin($module, /)\n"
"--\n"
"\n"
"Minimize the malloc() heap.\n"
"\n"
"Force the malloc() heap to clean itself up and return unused blocks\n"
"to the operating system. On failure, this raises OSError.");
#define MSVCRT_HEAPMIN_METHODDEF \
{"heapmin", (PyCFunction)msvcrt_heapmin, METH_NOARGS, msvcrt_heapmin__doc__},
static PyObject *
msvcrt_heapmin_impl(PyObject *module);
static PyObject *
msvcrt_heapmin(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return msvcrt_heapmin_impl(module);
}
PyDoc_STRVAR(msvcrt_locking__doc__,
"locking($module, fd, mode, nbytes, /)\n"
"--\n"
"\n"
"Lock part of a file based on file descriptor fd from the C runtime.\n"
"\n"
"Raises OSError on failure. The locked region of the file extends from\n"
"the current file position for nbytes bytes, and may continue beyond\n"
"the end of the file. mode must be one of the LK_* constants listed\n"
"below. Multiple regions in a file may be locked at the same time, but\n"
"may not overlap. Adjacent regions are not merged; they must be unlocked\n"
"individually.");
#define MSVCRT_LOCKING_METHODDEF \
{"locking", (PyCFunction)(void(*)(void))msvcrt_locking, METH_FASTCALL, msvcrt_locking__doc__},
static PyObject *
msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes);
static PyObject *
msvcrt_locking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int mode;
long nbytes;
if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) {
goto exit;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nbytes = PyLong_AsLong(args[2]);
if (nbytes == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = msvcrt_locking_impl(module, fd, mode, nbytes);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_setmode__doc__,
"setmode($module, fd, mode, /)\n"
"--\n"
"\n"
"Set the line-end translation mode for the file descriptor fd.\n"
"\n"
"To set it to text mode, flags should be os.O_TEXT; for binary, it\n"
"should be os.O_BINARY.\n"
"\n"
"Return value is the previous mode.");
#define MSVCRT_SETMODE_METHODDEF \
{"setmode", (PyCFunction)(void(*)(void))msvcrt_setmode, METH_FASTCALL, msvcrt_setmode__doc__},
static long
msvcrt_setmode_impl(PyObject *module, int fd, int flags);
static PyObject *
msvcrt_setmode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int flags;
long _return_value;
if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) {
goto exit;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = msvcrt_setmode_impl(module, fd, flags);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromLong(_return_value);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_open_osfhandle__doc__,
"open_osfhandle($module, handle, flags, /)\n"
"--\n"
"\n"
"Create a C runtime file descriptor from the file handle handle.\n"
"\n"
"The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,\n"
"and os.O_TEXT. The returned file descriptor may be used as a parameter\n"
"to os.fdopen() to create a file object.");
#define MSVCRT_OPEN_OSFHANDLE_METHODDEF \
{"open_osfhandle", (PyCFunction)(void(*)(void))msvcrt_open_osfhandle, METH_FASTCALL, msvcrt_open_osfhandle__doc__},
static long
msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags);
static PyObject *
msvcrt_open_osfhandle(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
void *handle;
int flags;
long _return_value;
if (!_PyArg_ParseStack(args, nargs, ""_Py_PARSE_UINTPTR"i:open_osfhandle",
&handle, &flags)) {
goto exit;
}
_return_value = msvcrt_open_osfhandle_impl(module, handle, flags);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromLong(_return_value);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_get_osfhandle__doc__,
"get_osfhandle($module, fd, /)\n"
"--\n"
"\n"
"Return the file handle for the file descriptor fd.\n"
"\n"
"Raises OSError if fd is not recognized.");
#define MSVCRT_GET_OSFHANDLE_METHODDEF \
{"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__},
static void *
msvcrt_get_osfhandle_impl(PyObject *module, int fd);
static PyObject *
msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int fd;
void *_return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = msvcrt_get_osfhandle_impl(module, fd);
if ((_return_value == NULL || _return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromVoidPtr(_return_value);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_kbhit__doc__,
"kbhit($module, /)\n"
"--\n"
"\n"
"Return true if a keypress is waiting to be read.");
#define MSVCRT_KBHIT_METHODDEF \
{"kbhit", (PyCFunction)msvcrt_kbhit, METH_NOARGS, msvcrt_kbhit__doc__},
static long
msvcrt_kbhit_impl(PyObject *module);
static PyObject *
msvcrt_kbhit(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
long _return_value;
_return_value = msvcrt_kbhit_impl(module);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromLong(_return_value);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_getch__doc__,
"getch($module, /)\n"
"--\n"
"\n"
"Read a keypress and return the resulting character as a byte string.\n"
"\n"
"Nothing is echoed to the console. This call will block if a keypress is\n"
"not already available, but will not wait for Enter to be pressed. If the\n"
"pressed key was a special function key, this will return \'\\000\' or\n"
"\'\\xe0\'; the next call will return the keycode. The Control-C keypress\n"
"cannot be read with this function.");
#define MSVCRT_GETCH_METHODDEF \
{"getch", (PyCFunction)msvcrt_getch, METH_NOARGS, msvcrt_getch__doc__},
static int
msvcrt_getch_impl(PyObject *module);
static PyObject *
msvcrt_getch(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
char s[1];
s[0] = msvcrt_getch_impl(module);
return_value = PyBytes_FromStringAndSize(s, 1);
return return_value;
}
PyDoc_STRVAR(msvcrt_getwch__doc__,
"getwch($module, /)\n"
"--\n"
"\n"
"Wide char variant of getch(), returning a Unicode value.");
#define MSVCRT_GETWCH_METHODDEF \
{"getwch", (PyCFunction)msvcrt_getwch, METH_NOARGS, msvcrt_getwch__doc__},
static wchar_t
msvcrt_getwch_impl(PyObject *module);
static PyObject *
msvcrt_getwch(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
wchar_t _return_value;
_return_value = msvcrt_getwch_impl(module);
return_value = PyUnicode_FromOrdinal(_return_value);
return return_value;
}
PyDoc_STRVAR(msvcrt_getche__doc__,
"getche($module, /)\n"
"--\n"
"\n"
"Similar to getch(), but the keypress will be echoed if possible.");
#define MSVCRT_GETCHE_METHODDEF \
{"getche", (PyCFunction)msvcrt_getche, METH_NOARGS, msvcrt_getche__doc__},
static int
msvcrt_getche_impl(PyObject *module);
static PyObject *
msvcrt_getche(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
char s[1];
s[0] = msvcrt_getche_impl(module);
return_value = PyBytes_FromStringAndSize(s, 1);
return return_value;
}
PyDoc_STRVAR(msvcrt_getwche__doc__,
"getwche($module, /)\n"
"--\n"
"\n"
"Wide char variant of getche(), returning a Unicode value.");
#define MSVCRT_GETWCHE_METHODDEF \
{"getwche", (PyCFunction)msvcrt_getwche, METH_NOARGS, msvcrt_getwche__doc__},
static wchar_t
msvcrt_getwche_impl(PyObject *module);
static PyObject *
msvcrt_getwche(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
wchar_t _return_value;
_return_value = msvcrt_getwche_impl(module);
return_value = PyUnicode_FromOrdinal(_return_value);
return return_value;
}
PyDoc_STRVAR(msvcrt_putch__doc__,
"putch($module, char, /)\n"
"--\n"
"\n"
"Print the byte string char to the console without buffering.");
#define MSVCRT_PUTCH_METHODDEF \
{"putch", (PyCFunction)msvcrt_putch, METH_O, msvcrt_putch__doc__},
static PyObject *
msvcrt_putch_impl(PyObject *module, char char_value);
static PyObject *
msvcrt_putch(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
char char_value;
if (PyBytes_Check(arg) && PyBytes_GET_SIZE(arg) == 1) {
char_value = PyBytes_AS_STRING(arg)[0];
}
else if (PyByteArray_Check(arg) && PyByteArray_GET_SIZE(arg) == 1) {
char_value = PyByteArray_AS_STRING(arg)[0];
}
else {
_PyArg_BadArgument("putch", "argument", "a byte string of length 1", arg);
goto exit;
}
return_value = msvcrt_putch_impl(module, char_value);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_putwch__doc__,
"putwch($module, unicode_char, /)\n"
"--\n"
"\n"
"Wide char variant of putch(), accepting a Unicode value.");
#define MSVCRT_PUTWCH_METHODDEF \
{"putwch", (PyCFunction)msvcrt_putwch, METH_O, msvcrt_putwch__doc__},
static PyObject *
msvcrt_putwch_impl(PyObject *module, int unicode_char);
static PyObject *
msvcrt_putwch(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int unicode_char;
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
goto exit;
}
if (PyUnicode_READY(arg)) {
goto exit;
}
if (PyUnicode_GET_LENGTH(arg) != 1) {
_PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
goto exit;
}
unicode_char = PyUnicode_READ_CHAR(arg, 0);
return_value = msvcrt_putwch_impl(module, unicode_char);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_ungetch__doc__,
"ungetch($module, char, /)\n"
"--\n"
"\n"
"Opposite of getch.\n"
"\n"
"Cause the byte string char to be \"pushed back\" into the\n"
"console buffer; it will be the next character read by\n"
"getch() or getche().");
#define MSVCRT_UNGETCH_METHODDEF \
{"ungetch", (PyCFunction)msvcrt_ungetch, METH_O, msvcrt_ungetch__doc__},
static PyObject *
msvcrt_ungetch_impl(PyObject *module, char char_value);
static PyObject *
msvcrt_ungetch(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
char char_value;
if (PyBytes_Check(arg) && PyBytes_GET_SIZE(arg) == 1) {
char_value = PyBytes_AS_STRING(arg)[0];
}
else if (PyByteArray_Check(arg) && PyByteArray_GET_SIZE(arg) == 1) {
char_value = PyByteArray_AS_STRING(arg)[0];
}
else {
_PyArg_BadArgument("ungetch", "argument", "a byte string of length 1", arg);
goto exit;
}
return_value = msvcrt_ungetch_impl(module, char_value);
exit:
return return_value;
}
PyDoc_STRVAR(msvcrt_ungetwch__doc__,
"ungetwch($module, unicode_char, /)\n"
"--\n"
"\n"
"Wide char variant of ungetch(), accepting a Unicode value.");
#define MSVCRT_UNGETWCH_METHODDEF \
{"ungetwch", (PyCFunction)msvcrt_ungetwch, METH_O, msvcrt_ungetwch__doc__},
static PyObject *
msvcrt_ungetwch_impl(PyObject *module, int unicode_char);
static PyObject *
msvcrt_ungetwch(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int unicode_char;
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
goto exit;
}
if (PyUnicode_READY(arg)) {
goto exit;
}
if (PyUnicode_GET_LENGTH(arg) != 1) {
_PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
goto exit;
}
unicode_char = PyUnicode_READ_CHAR(arg, 0);
return_value = msvcrt_ungetwch_impl(module, unicode_char);
exit:
return return_value;
}
#if defined(_DEBUG)
PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__,
"CrtSetReportFile($module, type, file, /)\n"
"--\n"
"\n"
"Wrapper around _CrtSetReportFile.\n"
"\n"
"Only available on Debug builds.");
#define MSVCRT_CRTSETREPORTFILE_METHODDEF \
{"CrtSetReportFile", (PyCFunction)(void(*)(void))msvcrt_CrtSetReportFile, METH_FASTCALL, msvcrt_CrtSetReportFile__doc__},
static void *
msvcrt_CrtSetReportFile_impl(PyObject *module, int type, void *file);
static PyObject *
msvcrt_CrtSetReportFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int type;
void *file;
void *_return_value;
if (!_PyArg_ParseStack(args, nargs, "i"_Py_PARSE_UINTPTR":CrtSetReportFile",
&type, &file)) {
goto exit;
}
_return_value = msvcrt_CrtSetReportFile_impl(module, type, file);
if ((_return_value == NULL || _return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromVoidPtr(_return_value);
exit:
return return_value;
}
#endif /* defined(_DEBUG) */
#if defined(_DEBUG)
PyDoc_STRVAR(msvcrt_CrtSetReportMode__doc__,
"CrtSetReportMode($module, type, mode, /)\n"
"--\n"
"\n"
"Wrapper around _CrtSetReportMode.\n"
"\n"
"Only available on Debug builds.");
#define MSVCRT_CRTSETREPORTMODE_METHODDEF \
{"CrtSetReportMode", (PyCFunction)(void(*)(void))msvcrt_CrtSetReportMode, METH_FASTCALL, msvcrt_CrtSetReportMode__doc__},
static long
msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode);
static PyObject *
msvcrt_CrtSetReportMode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int type;
int mode;
long _return_value;
if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
goto exit;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = msvcrt_CrtSetReportMode_impl(module, type, mode);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromLong(_return_value);
exit:
return return_value;
}
#endif /* defined(_DEBUG) */
#if defined(_DEBUG)
PyDoc_STRVAR(msvcrt_set_error_mode__doc__,
"set_error_mode($module, mode, /)\n"
"--\n"
"\n"
"Wrapper around _set_error_mode.\n"
"\n"
"Only available on Debug builds.");
#define MSVCRT_SET_ERROR_MODE_METHODDEF \
{"set_error_mode", (PyCFunction)msvcrt_set_error_mode, METH_O, msvcrt_set_error_mode__doc__},
static long
msvcrt_set_error_mode_impl(PyObject *module, int mode);
static PyObject *
msvcrt_set_error_mode(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int mode;
long _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(arg);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = msvcrt_set_error_mode_impl(module, mode);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromLong(_return_value);
exit:
return return_value;
}
#endif /* defined(_DEBUG) */
PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
"SetErrorMode($module, mode, /)\n"
"--\n"
"\n"
"Wrapper around SetErrorMode.");
#define MSVCRT_SETERRORMODE_METHODDEF \
{"SetErrorMode", (PyCFunction)msvcrt_SetErrorMode, METH_O, msvcrt_SetErrorMode__doc__},
static PyObject *
msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode);
static PyObject *
msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
unsigned int mode;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
if (mode == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
}
return_value = msvcrt_SetErrorMode_impl(module, mode);
exit:
return return_value;
}
#ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF
#define MSVCRT_CRTSETREPORTFILE_METHODDEF
#endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */
#ifndef MSVCRT_CRTSETREPORTMODE_METHODDEF
#define MSVCRT_CRTSETREPORTMODE_METHODDEF
#endif /* !defined(MSVCRT_CRTSETREPORTMODE_METHODDEF) */
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
#define MSVCRT_SET_ERROR_MODE_METHODDEF
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
/*[clinic end generated code: output=7cc6ffaf64f268f7 input=a9049054013a1b77]*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,154 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(winsound_PlaySound__doc__,
"PlaySound($module, /, sound, flags)\n"
"--\n"
"\n"
"A wrapper around the Windows PlaySound API.\n"
"\n"
" sound\n"
" The sound to play; a filename, data, or None.\n"
" flags\n"
" Flag values, ored together. See module documentation.");
#define WINSOUND_PLAYSOUND_METHODDEF \
{"PlaySound", (PyCFunction)(void(*)(void))winsound_PlaySound, METH_FASTCALL|METH_KEYWORDS, winsound_PlaySound__doc__},
static PyObject *
winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags);
static PyObject *
winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sound", "flags", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "PlaySound", 0};
PyObject *argsbuf[2];
PyObject *sound;
int flags;
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
sound = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = winsound_PlaySound_impl(module, sound, flags);
exit:
return return_value;
}
PyDoc_STRVAR(winsound_Beep__doc__,
"Beep($module, /, frequency, duration)\n"
"--\n"
"\n"
"A wrapper around the Windows Beep API.\n"
"\n"
" frequency\n"
" Frequency of the sound in hertz.\n"
" Must be in the range 37 through 32,767.\n"
" duration\n"
" How long the sound should play, in milliseconds.");
#define WINSOUND_BEEP_METHODDEF \
{"Beep", (PyCFunction)(void(*)(void))winsound_Beep, METH_FASTCALL|METH_KEYWORDS, winsound_Beep__doc__},
static PyObject *
winsound_Beep_impl(PyObject *module, int frequency, int duration);
static PyObject *
winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"frequency", "duration", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "Beep", 0};
PyObject *argsbuf[2];
int frequency;
int duration;
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
frequency = _PyLong_AsInt(args[0]);
if (frequency == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
duration = _PyLong_AsInt(args[1]);
if (duration == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = winsound_Beep_impl(module, frequency, duration);
exit:
return return_value;
}
PyDoc_STRVAR(winsound_MessageBeep__doc__,
"MessageBeep($module, /, type=MB_OK)\n"
"--\n"
"\n"
"Call Windows MessageBeep(x).\n"
"\n"
"x defaults to MB_OK.");
#define WINSOUND_MESSAGEBEEP_METHODDEF \
{"MessageBeep", (PyCFunction)(void(*)(void))winsound_MessageBeep, METH_FASTCALL|METH_KEYWORDS, winsound_MessageBeep__doc__},
static PyObject *
winsound_MessageBeep_impl(PyObject *module, int type);
static PyObject *
winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"type", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "MessageBeep", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int type = MB_OK;
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = winsound_MessageBeep_impl(module, type);
exit:
return return_value;
}
/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/

View File

@ -0,0 +1,178 @@
/* Module configuration */
/* This file contains the table of built-in modules.
See create_builtin() in import.c. */
#include "Python.h"
extern PyObject* PyInit__abc(void);
extern PyObject* PyInit_array(void);
extern PyObject* PyInit_audioop(void);
extern PyObject* PyInit_binascii(void);
extern PyObject* PyInit_cmath(void);
extern PyObject* PyInit_errno(void);
extern PyObject* PyInit_faulthandler(void);
extern PyObject* PyInit__tracemalloc(void);
extern PyObject* PyInit_gc(void);
extern PyObject* PyInit_math(void);
extern PyObject* PyInit__md5(void);
extern PyObject* PyInit_nt(void);
extern PyObject* PyInit__operator(void);
extern PyObject* PyInit__signal(void);
extern PyObject* PyInit__sha1(void);
extern PyObject* PyInit__sha256(void);
extern PyObject* PyInit__sha512(void);
extern PyObject* PyInit__sha3(void);
extern PyObject* PyInit__statistics(void);
extern PyObject* PyInit__blake2(void);
extern PyObject* PyInit_time(void);
extern PyObject* PyInit__thread(void);
#ifdef WIN32
extern PyObject* PyInit_msvcrt(void);
extern PyObject* PyInit__locale(void);
#endif
extern PyObject* PyInit__codecs(void);
extern PyObject* PyInit__weakref(void);
/* XXX: These two should really be extracted to standalone extensions. */
extern PyObject* PyInit_xxsubtype(void);
extern PyObject* PyInit__xxsubinterpreters(void);
extern PyObject* PyInit__random(void);
extern PyObject* PyInit_itertools(void);
extern PyObject* PyInit__collections(void);
extern PyObject* PyInit__heapq(void);
extern PyObject* PyInit__bisect(void);
extern PyObject* PyInit__symtable(void);
extern PyObject* PyInit_mmap(void);
extern PyObject* PyInit__csv(void);
extern PyObject* PyInit__sre(void);
extern PyObject* PyInit_parser(void);
extern PyObject* PyInit_winreg(void);
extern PyObject* PyInit__struct(void);
extern PyObject* PyInit__datetime(void);
extern PyObject* PyInit__functools(void);
extern PyObject* PyInit__json(void);
#ifdef _Py_HAVE_ZLIB
extern PyObject* PyInit_zlib(void);
#endif
extern PyObject* PyInit__multibytecodec(void);
extern PyObject* PyInit__codecs_cn(void);
extern PyObject* PyInit__codecs_hk(void);
extern PyObject* PyInit__codecs_iso2022(void);
extern PyObject* PyInit__codecs_jp(void);
extern PyObject* PyInit__codecs_kr(void);
extern PyObject* PyInit__codecs_tw(void);
extern PyObject* PyInit__winapi(void);
extern PyObject* PyInit__lsprof(void);
extern PyObject* PyInit__ast(void);
extern PyObject* PyInit__io(void);
extern PyObject* PyInit__pickle(void);
extern PyObject* PyInit_atexit(void);
extern PyObject* _PyWarnings_Init(void);
extern PyObject* PyInit__string(void);
extern PyObject* PyInit__stat(void);
extern PyObject* PyInit__opcode(void);
extern PyObject* PyInit__contextvars(void);
extern PyObject* PyInit__peg_parser(void);
/* tools/freeze/makeconfig.py marker for additional "extern" */
/* -- ADDMODULE MARKER 1 -- */
extern PyObject* PyMarshal_Init(void);
extern PyObject* PyInit__imp(void);
struct _inittab _PyImport_Inittab[] = {
{"_abc", PyInit__abc},
{"array", PyInit_array},
{"_ast", PyInit__ast},
{"audioop", PyInit_audioop},
{"binascii", PyInit_binascii},
{"cmath", PyInit_cmath},
{"errno", PyInit_errno},
{"faulthandler", PyInit_faulthandler},
{"gc", PyInit_gc},
{"math", PyInit_math},
{"nt", PyInit_nt}, /* Use the NT os functions, not posix */
{"_operator", PyInit__operator},
{"_signal", PyInit__signal},
{"_md5", PyInit__md5},
{"_sha1", PyInit__sha1},
{"_sha256", PyInit__sha256},
{"_sha512", PyInit__sha512},
{"_sha3", PyInit__sha3},
{"_blake2", PyInit__blake2},
{"time", PyInit_time},
{"_thread", PyInit__thread},
{"_statistics", PyInit__statistics},
#ifdef WIN32
{"msvcrt", PyInit_msvcrt},
{"_locale", PyInit__locale},
#endif
{"_tracemalloc", PyInit__tracemalloc},
/* XXX Should _winapi go in a WIN32 block? not WIN64? */
{"_winapi", PyInit__winapi},
{"_codecs", PyInit__codecs},
{"_weakref", PyInit__weakref},
{"_random", PyInit__random},
{"_bisect", PyInit__bisect},
{"_heapq", PyInit__heapq},
{"_lsprof", PyInit__lsprof},
{"itertools", PyInit_itertools},
{"_collections", PyInit__collections},
{"_symtable", PyInit__symtable},
{"mmap", PyInit_mmap},
{"_csv", PyInit__csv},
{"_sre", PyInit__sre},
{"parser", PyInit_parser},
{"winreg", PyInit_winreg},
{"_struct", PyInit__struct},
{"_datetime", PyInit__datetime},
{"_functools", PyInit__functools},
{"_json", PyInit__json},
{"xxsubtype", PyInit_xxsubtype},
{"_xxsubinterpreters", PyInit__xxsubinterpreters},
#ifdef _Py_HAVE_ZLIB
{"zlib", PyInit_zlib},
#endif
/* CJK codecs */
{"_multibytecodec", PyInit__multibytecodec},
{"_codecs_cn", PyInit__codecs_cn},
{"_codecs_hk", PyInit__codecs_hk},
{"_codecs_iso2022", PyInit__codecs_iso2022},
{"_codecs_jp", PyInit__codecs_jp},
{"_codecs_kr", PyInit__codecs_kr},
{"_codecs_tw", PyInit__codecs_tw},
/* tools/freeze/makeconfig.py marker for additional "_inittab" entries */
/* -- ADDMODULE MARKER 2 -- */
/* This module "lives in" with marshal.c */
{"marshal", PyMarshal_Init},
/* This lives it with import.c */
{"_imp", PyInit__imp},
/* These entries are here for sys.builtin_module_names */
{"builtins", NULL},
{"sys", NULL},
{"_warnings", _PyWarnings_Init},
{"_string", PyInit__string},
{"_io", PyInit__io},
{"_pickle", PyInit__pickle},
{"atexit", PyInit_atexit},
{"_stat", PyInit__stat},
{"_opcode", PyInit__opcode},
{"_contextvars", PyInit__contextvars},
{"_peg_parser", PyInit__peg_parser},
/* Sentinel */
{0, 0}
};

View File

@ -0,0 +1,41 @@
Additional Conditions for this Windows binary build
---------------------------------------------------
This program is linked with and uses Microsoft Distributable Code,
copyrighted by Microsoft Corporation. The Microsoft Distributable Code
is embedded in each .exe, .dll and .pyd file as a result of running
the code through a linker.
If you further distribute programs that include the Microsoft
Distributable Code, you must comply with the restrictions on
distribution specified by Microsoft. In particular, you must require
distributors and external end users to agree to terms that protect the
Microsoft Distributable Code at least as much as Microsoft's own
requirements for the Distributable Code. See Microsoft's documentation
(included in its developer tools and on its website at microsoft.com)
for specific details.
Redistribution of the Windows binary build of the Python interpreter
complies with this agreement, provided that you do not:
- alter any copyright, trademark or patent notice in Microsoft's
Distributable Code;
- use Microsoft's trademarks in your programs' names or in a way that
suggests your programs come from or are endorsed by Microsoft;
- distribute Microsoft's Distributable Code to run on a platform other
than Microsoft operating systems, run-time technologies or application
platforms; or
- include Microsoft Distributable Code in malicious, deceptive or
unlawful programs.
These restrictions apply only to the Microsoft Distributable Code as
defined above, not to Python itself or any programs running on the
Python interpreter. The redistribution of the Python interpreter and
libraries is governed by the Python Software License included with this
file, or by other licenses as marked.

View File

@ -0,0 +1,36 @@
/*
Entry point for the Windows NT DLL.
About the only reason for having this, is so initall() can automatically
be called, removing that burden (and possible source of frustration if
forgotten) from the programmer.
*/
#include "Python.h"
#include "windows.h"
#ifdef Py_ENABLE_SHARED
// Python Globals
HMODULE PyWin_DLLhModule = NULL;
const char *PyWin_DLLVersionString = MS_DLL_ID;
BOOL WINAPI DllMain (HANDLE hInst,
ULONG ul_reason_for_call,
LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
PyWin_DLLhModule = hInst;
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif /* Py_ENABLE_SHARED */

View File

@ -0,0 +1,6 @@
#include <windows.h>
int __stdcall
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
return 0;
}

View File

@ -0,0 +1,140 @@
int
winerror_to_errno(int winerror)
{
// Unwrap FACILITY_WIN32 HRESULT errors.
if ((winerror & 0xFFFF0000) == 0x80070000) {
winerror &= 0x0000FFFF;
}
// Winsock error codes (10000-11999) are errno values.
if (winerror >= 10000 && winerror < 12000) {
switch (winerror) {
case WSAEINTR:
case WSAEBADF:
case WSAEACCES:
case WSAEFAULT:
case WSAEINVAL:
case WSAEMFILE:
// Winsock definitions of errno values. See WinSock2.h
return winerror - 10000;
default:
return winerror;
}
}
switch (winerror) {
case ERROR_FILE_NOT_FOUND: // 2
case ERROR_PATH_NOT_FOUND: // 3
case ERROR_INVALID_DRIVE: // 15
case ERROR_NO_MORE_FILES: // 18
case ERROR_BAD_NETPATH: // 53
case ERROR_BAD_NET_NAME: // 67
case ERROR_BAD_PATHNAME: // 161
case ERROR_FILENAME_EXCED_RANGE: // 206
return ENOENT;
case ERROR_BAD_ENVIRONMENT: // 10
return E2BIG;
case ERROR_BAD_FORMAT: // 11
case ERROR_INVALID_STARTING_CODESEG: // 188
case ERROR_INVALID_STACKSEG: // 189
case ERROR_INVALID_MODULETYPE: // 190
case ERROR_INVALID_EXE_SIGNATURE: // 191
case ERROR_EXE_MARKED_INVALID: // 192
case ERROR_BAD_EXE_FORMAT: // 193
case ERROR_ITERATED_DATA_EXCEEDS_64k: // 194
case ERROR_INVALID_MINALLOCSIZE: // 195
case ERROR_DYNLINK_FROM_INVALID_RING: // 196
case ERROR_IOPL_NOT_ENABLED: // 197
case ERROR_INVALID_SEGDPL: // 198
case ERROR_AUTODATASEG_EXCEEDS_64k: // 199
case ERROR_RING2SEG_MUST_BE_MOVABLE: // 200
case ERROR_RELOC_CHAIN_XEEDS_SEGLIM: // 201
case ERROR_INFLOOP_IN_RELOC_CHAIN: // 202
return ENOEXEC;
case ERROR_INVALID_HANDLE: // 6
case ERROR_INVALID_TARGET_HANDLE: // 114
case ERROR_DIRECT_ACCESS_HANDLE: // 130
return EBADF;
case ERROR_WAIT_NO_CHILDREN: // 128
case ERROR_CHILD_NOT_COMPLETE: // 129
return ECHILD;
case ERROR_NO_PROC_SLOTS: // 89
case ERROR_MAX_THRDS_REACHED: // 164
case ERROR_NESTING_NOT_ALLOWED: // 215
return EAGAIN;
case ERROR_ARENA_TRASHED: // 7
case ERROR_NOT_ENOUGH_MEMORY: // 8
case ERROR_INVALID_BLOCK: // 9
case ERROR_NOT_ENOUGH_QUOTA: // 1816
return ENOMEM;
case ERROR_ACCESS_DENIED: // 5
case ERROR_CURRENT_DIRECTORY: // 16
case ERROR_WRITE_PROTECT: // 19
case ERROR_BAD_UNIT: // 20
case ERROR_NOT_READY: // 21
case ERROR_BAD_COMMAND: // 22
case ERROR_CRC: // 23
case ERROR_BAD_LENGTH: // 24
case ERROR_SEEK: // 25
case ERROR_NOT_DOS_DISK: // 26
case ERROR_SECTOR_NOT_FOUND: // 27
case ERROR_OUT_OF_PAPER: // 28
case ERROR_WRITE_FAULT: // 29
case ERROR_READ_FAULT: // 30
case ERROR_GEN_FAILURE: // 31
case ERROR_SHARING_VIOLATION: // 32
case ERROR_LOCK_VIOLATION: // 33
case ERROR_WRONG_DISK: // 34
case ERROR_SHARING_BUFFER_EXCEEDED: // 36
case ERROR_NETWORK_ACCESS_DENIED: // 65
case ERROR_CANNOT_MAKE: // 82
case ERROR_FAIL_I24: // 83
case ERROR_DRIVE_LOCKED: // 108
case ERROR_SEEK_ON_DEVICE: // 132
case ERROR_NOT_LOCKED: // 158
case ERROR_LOCK_FAILED: // 167
case 35: // 35 (undefined)
return EACCES;
case ERROR_FILE_EXISTS: // 80
case ERROR_ALREADY_EXISTS: // 183
return EEXIST;
case ERROR_NOT_SAME_DEVICE: // 17
return EXDEV;
case ERROR_DIRECTORY: // 267 (bpo-12802)
return ENOTDIR;
case ERROR_TOO_MANY_OPEN_FILES: // 4
return EMFILE;
case ERROR_DISK_FULL: // 112
return ENOSPC;
case ERROR_BROKEN_PIPE: // 109
case ERROR_NO_DATA: // 232 (bpo-13063)
return EPIPE;
case ERROR_DIR_NOT_EMPTY: // 145
return ENOTEMPTY;
case ERROR_NO_UNICODE_TRANSLATION: // 1113
return EILSEQ;
case ERROR_INVALID_FUNCTION: // 1
case ERROR_INVALID_ACCESS: // 12
case ERROR_INVALID_DATA: // 13
case ERROR_INVALID_PARAMETER: // 87
case ERROR_NEGATIVE_SEEK: // 131
default:
return EINVAL;
}
}

View File

@ -0,0 +1,5 @@
errmap.h: generrmap.exe
.\generrmap.exe > errmap.h
genermap.exe: generrmap.c
cl generrmap.c

View File

@ -0,0 +1,134 @@
/* FreezeDLLMain.cpp
This is a DLLMain suitable for frozen applications/DLLs on
a Windows platform.
The general problem is that many Python extension modules may define
DLL main functions, but when statically linked together to form
a frozen application, this DLLMain symbol exists multiple times.
The solution is:
* Each module checks for a frozen build, and if so, defines its DLLMain
function as "__declspec(dllexport) DllMain%module%"
(eg, DllMainpythoncom, or DllMainpywintypes)
* The frozen .EXE/.DLL links against this module, which provides
the single DllMain.
* This DllMain attempts to locate and call the DllMain for each
of the extension modules.
* This code also has hooks to "simulate" DllMain when used from
a frozen .EXE.
At this stage, there is a static table of "possibly embedded modules".
This should change to something better, but it will work OK for now.
Note that this scheme does not handle dependencies in the order
of DllMain calls - except it does call pywintypes first :-)
As an example of how an extension module with a DllMain should be
changed, here is a snippet from the pythoncom extension module.
// end of example code from pythoncom's DllMain.cpp
#ifndef BUILD_FREEZE
#define DLLMAIN DllMain
#define DLLMAIN_DECL
#else
#define DLLMAIN DllMainpythoncom
#define DLLMAIN_DECL __declspec(dllexport)
#endif
extern "C" DLLMAIN_DECL
BOOL WINAPI DLLMAIN(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
// end of example code from pythoncom's DllMain.cpp
***************************************************************************/
#include "windows.h"
static char *possibleModules[] = {
"pywintypes",
"pythoncom",
"win32ui",
NULL,
};
BOOL CallModuleDllMain(char *modName, DWORD dwReason);
/*
Called by a frozen .EXE only, so that built-in extension
modules are initialized correctly
*/
void PyWinFreeze_ExeInit(void)
{
char **modName;
for (modName = possibleModules;*modName;*modName++) {
/* printf("Initialising '%s'\n", *modName); */
CallModuleDllMain(*modName, DLL_PROCESS_ATTACH);
}
}
/*
Called by a frozen .EXE only, so that built-in extension
modules are cleaned up
*/
void PyWinFreeze_ExeTerm(void)
{
// Must go backwards
char **modName;
for (modName = possibleModules+Py_ARRAY_LENGTH(possibleModules)-2;
modName >= possibleModules;
*modName--) {
/* printf("Terminating '%s'\n", *modName);*/
CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
}
}
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
BOOL ret = TRUE;
switch (dwReason) {
case DLL_PROCESS_ATTACH:
{
char **modName;
for (modName = possibleModules;*modName;*modName++) {
BOOL ok = CallModuleDllMain(*modName, dwReason);
if (!ok)
ret = FALSE;
}
break;
}
case DLL_PROCESS_DETACH:
{
// Must go backwards
char **modName;
for (modName = possibleModules+Py_ARRAY_LENGTH(possibleModules)-2;
modName >= possibleModules;
*modName--)
CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
break;
}
}
return ret;
}
BOOL CallModuleDllMain(char *modName, DWORD dwReason)
{
BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID);
char funcName[255];
HMODULE hmod = GetModuleHandleW(NULL);
strcpy(funcName, "_DllMain");
strcat(funcName, modName);
strcat(funcName, "@12"); // stdcall convention.
pfndllmain = (BOOL (WINAPI *)(HINSTANCE, DWORD, LPVOID))GetProcAddress(hmod, funcName);
if (pfndllmain==NULL) {
/* No function by that name exported - then that module does
not appear in our frozen program - return OK
*/
return TRUE;
}
return (*pfndllmain)(hmod, dwReason, NULL);
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-white{fill:#fff}.icon-vso-bg{fill:#656565}.icon-visualstudio-online{fill:#007acc}.graph-lightgrey{fill:#dfdfdf}.st0{fill:#0078d7}.st1{fill:#fff}.st2{fill:url(#path1948_1_)}.st3{fill:url(#path1950_1_)}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-visualstudio-online" d="M30 5H5V3h25v2z"/><path class="icon-vso-bg" d="M29.972 26.972H5.029V5h.942v21.028h23.057V5h.943v21.972z"/><path class="icon-vs-out" d="M29 5v21H6V5h23z"/><path class="icon-white" d="M29.141 4l.429.429-.14.142-.43-.43-.43.43-.14-.142.429-.429-.429-.429.141-.142.429.43.43-.43.141.142-.43.429zM27.6 3.4h-1.2v1.2h1.2V3.4zm-1 .2h.8v.8h-.8v-.8zm-1.139.8h-1v.2h1v-.2z"/><path class="graph-lightgrey" d="M6 5h23v2H6z"/></g><g id="iconFg"><path class="st0" d="M4.5 23v6"/><path class="st1" d="M11.429 13.019a19.88 19.88 0 0 0 .071-1.645c0-4.223-1.329-8.165-3.556-10.545L7.17 0H5.83l-.774.829C2.829 3.209 1.5 7.151 1.5 11.374c0 .453.023.9.053 1.345C.887 13.472.357 14.438 0 15.533v6.603L.229 23H3v7h2v2h3v-1h2v-8h2.772l.394-1.488c.222-.842.335-1.714.335-2.592-.001-2.419-.803-4.534-2.072-5.901z"/><path class="st0" d="M6.5 22v9M8.5 23v7"/><path class="icon-visualstudio-online" d="M5 29H4v-6h1v6zm2-6H6v8h1v-8zm2 0H8v7h1v-7z"/><path class="icon-vso-bg" d="M10.381 13.38c.07-.658.119-1.325.119-2.006 0-3.975-1.229-7.662-3.286-9.862L6.5.748l-.714.763C3.729 3.712 2.5 7.399 2.5 11.374c0 .681.049 1.348.119 2.006C1.339 14.521.5 16.552.5 18.92c0 .793.102 1.578.302 2.336L.999 22h1.966l.072-.922c.081-1.046.471-1.966.993-2.503.487 1.019 1.07 1.929 1.756 2.662L6.5 22l.714-.763c.686-.733 1.269-1.643 1.756-2.662.522.537.912 1.457.993 2.503l.072.922h1.966l.197-.744c.2-.758.302-1.543.302-2.336 0-2.368-.839-4.399-2.119-5.54z"/><path class="icon-vs-out" d="M3.619 17.615c-.854.672-1.464 1.913-1.579 3.385h-.272a8.184 8.184 0 0 1-.268-2.08c0-1.722.505-3.259 1.297-4.272.187 1.05.465 2.045.822 2.967zm6.585-2.967a16.145 16.145 0 0 1-.822 2.967c.854.671 1.464 1.913 1.579 3.385h.272a8.184 8.184 0 0 0 .268-2.08c-.001-1.722-.506-3.259-1.297-4.272zM3.5 11.374c0 3.837 1.198 7.2 3 9.128 1.802-1.927 3-5.291 3-9.128s-1.198-7.2-3-9.128c-1.802 1.928-3 5.291-3 9.128z"/><path class="icon-visualstudio-online" d="M7.5 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/></g><g id="colorImportance"><path class="icon-white" d="M31.596 23.961c-.35 1.053-1.001 3.015-3.247 3.015h-1.3v1.337c0 .905-.392 2.537-3.021 3.298a9.213 9.213 0 0 1-2.59.39c-.83 0-1.668-.128-2.564-.392-1.918-.563-3.017-1.765-3.017-3.296v-1.337h-1.155c-1.698 0-2.943-1.129-3.416-3.098-.469-1.946-.469-3.195 0-5.141.451-1.881 1.96-3.098 3.845-3.098h.726v-1.337c0-2.005.905-2.982 3.126-3.374.729-.13 1.549-.2 2.367-.203h.004c.925 0 1.761.067 2.56.201 1.816.303 3.134 1.723 3.134 3.376v1.337h1.3c1.142 0 2.636.536 3.27 3.092.516 2.073.51 3.637-.022 5.23z"/><linearGradient id="path1948_1_" gradientUnits="userSpaceOnUse" x1="522.205" y1="-288.668" x2="540.902" y2="-304.754" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#5a9fd4"/><stop offset="1" stop-color="#306998"/></linearGradient><path id="path1948_7_" class="st2" d="M21.354 11.725c-.786.004-1.537.071-2.197.188-1.946.344-2.299 1.063-2.299 2.39v1.753h4.598v.584h-6.324c-1.336 0-2.507.803-2.873 2.331-.422 1.751-.441 2.844 0 4.673.327 1.361 1.107 2.331 2.444 2.331h1.581v-2.101c0-1.518 1.313-2.857 2.873-2.857h4.593c1.279 0 2.299-1.053 2.299-2.337v-4.379c0-1.246-1.051-2.182-2.299-2.39-.79-.13-1.61-.189-2.396-.186zm-2.486 1.41c.475 0 .863.394.863.879a.87.87 0 0 1-.863.874.868.868 0 0 1-.863-.874c0-.485.386-.879.863-.879z"/><linearGradient id="path1950_1_" gradientUnits="userSpaceOnUse" x1="548.13" y1="-314.489" x2="541.454" y2="-305.043" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#ffd43b"/><stop offset="1" stop-color="#ffe873"/></linearGradient><path id="path1950_7_" class="st3" d="M26.623 16.64v2.042c0 1.583-1.342 2.915-2.873 2.915h-4.593c-1.258 0-2.299 1.077-2.299 2.337v4.379c0 1.246 1.084 1.979 2.299 2.337 1.456.428 2.851.505 4.593 0 1.158-.335 2.299-1.01 2.299-2.337V26.56h-4.593v-.584H28.348c1.336 0 1.834-.932 2.299-2.331.48-1.44.46-2.826 0-4.673-.33-1.33-.961-2.331-2.299-2.331h-1.725zm-2.584 11.089c.477 0 .863.391.863.874a.871.871 0 0 1-.863.879.872.872 0 0 1-.863-.879.87.87 0 0 1 .863-.874z"/></g></svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1 @@
<svg width="238" height="237" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="hidden"><defs><clipPath id="clip0"><path d="M706-314 944-314 944-77 706-77Z" fill-rule="evenodd" clip-rule="evenodd"/></clipPath></defs><g clip-path="url(#clip0)" transform="translate(-706 314)"><path d="M792.441-295.763C786.496-295.763 781.697-290.979 781.697-285.062 781.697-279.166 786.496-274.382 792.441-274.382 798.365-274.382 803.184-279.166 803.184-285.062 803.184-290.979 798.365-295.763 792.441-295.763ZM823.472-312.998C833.277-313.043 843.484-312.329 853.336-310.724 868.899-308.185 882-296.728 882-281.516L882-228.072C882-212.398 869.282-199.557 853.336-199.557L796.03-199.557C776.58-199.557 760.189-183.169 760.189-164.641L760.189-139 740.485-139C723.817-139 714.114-150.877 710.037-167.494 704.538-189.82 704.772-203.124 710.037-224.505 714.602-243.159 729.189-253 745.857-253L767.365-253 824.693-253 824.693-260.134 767.365-260.134 767.365-281.516C767.365-297.715 771.76-306.527 796.03-310.724 804.268-312.151 813.668-312.953 823.472-312.998Z" fill="#366A96" fill-rule="evenodd"/><path d="M857.377-117.071C851.466-117.071 846.655-112.267 846.655-106.348 846.655-100.406 851.466-95.6026 857.377-95.6026 863.31-95.6026 868.099-100.406 868.099-106.348 868.099-112.267 863.31-117.071 857.377-117.071ZM889.563-253 911.007-253C927.662-253 935.502-240.696 939.614-224.39 945.334-201.743 945.589-184.804 939.614-167.148 933.828-150 927.642-138.539 911.007-138.539L882.402-138.539 825.211-138.539 825.211-131.375 882.402-131.375 882.402-109.908C882.402-93.6435 868.205-85.4055 853.796-81.2973 832.12-75.1034 814.722-76.0513 796.606-81.2973 781.476-85.6801 768-94.6332 768-109.908L768-163.568C768-179.01 780.947-192.199 796.606-192.199L853.796-192.199C872.846-192.199 889.563-208.568 889.563-227.971Z" fill="#FFC836" fill-rule="evenodd"/></g></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vso-bg{fill:#656565}.icon-vso-lightgrey{fill:#bfbfbf}.icon-white{fill:#fff}.st0{fill:url(#path1948_1_)}.st1{fill:url(#path1950_1_)}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-vs-out" d="M26 8.009V29H7V3h14.053L26 8.009z"/><path class="icon-vso-bg" d="M21.471 2H6v28h21V7.599L21.471 2zM21 3h.053l4.939 5H21V3zm5 26H7V3h13v6h6v20z"/></g><path class="icon-vso-lightgrey" d="M17 7H9V6h8v1zm0 2H9v1h8V9zm7 3H9v1h15v-1zm0 3H9v1h15v-1zm0 3H9v1h15v-1zm0 3H9v1h15v-1zm0 3H9v1h15v-1z" id="iconFg"/><g id="colorImportance"><path class="icon-white" d="M31.66 24.063C31.312 25.116 30.661 27 28.413 27H27v1.313c0 .905-.335 2.537-2.965 3.298-.904.261-1.694.389-2.531.389-.83 0-1.63-.128-2.526-.392C17.061 31.045 16 29.844 16 28.313V27h-1.232c-1.699 0-2.944-1.141-3.416-3.11-.469-1.946-.469-3.021 0-4.967.451-1.881 1.96-2.923 3.845-2.923H16v-1.697c0-2.005.866-2.845 3.087-3.238.727-.128 1.506-.065 2.327-.065h.003c.921 0 1.703-.07 2.504.064 1.818.302 3.079 1.585 3.079 3.239V16h1.413c1.142 0 2.636.356 3.27 2.912.515 2.072.509 3.559-.023 5.151z"/><linearGradient id="path1948_1_" gradientUnits="userSpaceOnUse" x1="522.32" y1="-288.668" x2="541.017" y2="-304.754" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#5a9fd4"/><stop offset="1" stop-color="#306998"/></linearGradient><path id="path1948_2_" class="st0" d="M21.419 11.725c-.786.004-1.537.071-2.197.188-1.946.344-2.299 1.063-2.299 2.39v1.753h4.598v.584h-6.324c-1.336 0-2.507.803-2.873 2.331-.422 1.751-.441 2.844 0 4.673.327 1.361 1.108 2.331 2.444 2.331h1.581v-2.101c0-1.518 1.313-2.857 2.873-2.857h4.593c1.278 0 2.299-1.053 2.299-2.337v-4.379c0-1.246-1.051-2.182-2.299-2.39-.79-.13-1.61-.189-2.396-.186zm-2.487 1.41c.475 0 .863.394.863.879a.87.87 0 0 1-.863.874.868.868 0 0 1-.863-.874c0-.485.387-.879.863-.879z"/><linearGradient id="path1950_1_" gradientUnits="userSpaceOnUse" x1="548.245" y1="-314.489" x2="541.569" y2="-305.043" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#ffd43b"/><stop offset="1" stop-color="#ffe873"/></linearGradient><path id="path1950_2_" class="st1" d="M26.687 16.64v2.042c0 1.583-1.342 2.915-2.873 2.915h-4.593c-1.258 0-2.299 1.077-2.299 2.337v4.379c0 1.246 1.084 1.979 2.299 2.337 1.456.428 2.851.505 4.593 0 1.158-.335 2.299-1.01 2.299-2.337V26.56H21.52v-.584H28.412c1.336 0 1.834-.932 2.299-2.331.48-1.44.46-2.826 0-4.673-.33-1.33-.961-2.331-2.299-2.331h-1.725zm-2.583 11.089c.477 0 .863.391.863.874a.871.871 0 0 1-.863.879.872.872 0 0 1-.863-.879c0-.484.388-.874.863-.874z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vso-bg{fill:#656565}.icon-vs-bg{fill:#424242}.icon-vs-green{fill:#393}.icon-white{fill:#fff}.st0{fill:url(#path1948_1_)}.st1{fill:url(#path1950_1_)}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-vs-bg" d="M21.053 3H7v26h19V8.009z"/><path class="icon-vso-bg" d="M21.471 2H6v28h21V7.599L21.471 2zM21 3h.053l4.939 5H21V3zm5 26H7V3h13v6h6v20z"/></g><path class="icon-vs-green" d="M10 16H9v-1h1v1zm1.011 5H9v1h2.032a8.368 8.368 0 0 1-.021-1zM14 10h2V9h-2v1zm-3-4H9v1h2V6zm0 6H9v1h2v-1zm2-3H9v1h4V9zm4-3v1h1V6h-1zm-3 6h-2v1h2v-1zm1-6h-2v1h2V6zm-4 10h1v-1h-1v1zm4-4v1h2v-1h-2zm-2 4h3v-1h-3v1zm-4 2v1h3v-1H9zm0 6v1h3v-1H9z" id="iconFg"/><g id="colorImportance"><path class="icon-white" d="M31.66 24.063C31.312 25.116 30.661 27 28.413 27H27v1.313c0 .905-.335 2.537-2.965 3.298-.904.261-1.694.389-2.531.389-.83 0-1.63-.128-2.526-.392C17.061 31.045 16 29.844 16 28.313V27h-1.232c-1.699 0-2.944-1.141-3.416-3.11-.469-1.946-.469-3.021 0-4.967.451-1.881 1.96-2.923 3.845-2.923H16v-1.697c0-2.005.866-2.845 3.087-3.238.727-.128 1.506-.065 2.327-.065h.003c.921 0 1.703-.07 2.504.064 1.818.302 3.079 1.585 3.079 3.239V16h1.413c1.142 0 2.636.356 3.27 2.912.515 2.072.509 3.558-.023 5.151z"/><linearGradient id="path1948_1_" gradientUnits="userSpaceOnUse" x1="522.32" y1="-288.668" x2="541.017" y2="-304.754" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#5a9fd4"/><stop offset="1" stop-color="#306998"/></linearGradient><path id="path1948_4_" class="st0" d="M21.419 11.725c-.786.004-1.537.071-2.197.188-1.946.344-2.299 1.063-2.299 2.39v1.753h4.598v.584h-6.324c-1.336 0-2.507.803-2.873 2.331-.422 1.751-.441 2.844 0 4.673.327 1.361 1.108 2.331 2.444 2.331h1.581v-2.101c0-1.518 1.313-2.857 2.873-2.857h4.593c1.278 0 2.299-1.053 2.299-2.337v-4.379c0-1.246-1.051-2.182-2.299-2.39-.79-.13-1.61-.189-2.396-.186zm-2.487 1.41c.475 0 .863.394.863.879a.87.87 0 0 1-.863.874.868.868 0 0 1-.863-.874c0-.485.387-.879.863-.879z"/><linearGradient id="path1950_1_" gradientUnits="userSpaceOnUse" x1="548.245" y1="-314.489" x2="541.569" y2="-305.043" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#ffd43b"/><stop offset="1" stop-color="#ffe873"/></linearGradient><path id="path1950_4_" class="st1" d="M26.687 16.64v2.042c0 1.583-1.342 2.915-2.873 2.915h-4.593c-1.258 0-2.299 1.077-2.299 2.337v4.379c0 1.246 1.084 1.979 2.299 2.337 1.456.428 2.851.505 4.593 0 1.158-.335 2.299-1.01 2.299-2.337V26.56H21.52v-.584H28.412c1.336 0 1.834-.932 2.299-2.331.48-1.44.46-2.826 0-4.673-.33-1.33-.961-2.331-2.299-2.331h-1.725zm-2.583 11.089c.477 0 .863.391.863.874a.871.871 0 0 1-.863.879.872.872 0 0 1-.863-.879c0-.484.388-.874.863-.874z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-white{fill:#fff}.icon-vso-bg{fill:#656565}.icon-visualstudio-online{fill:#007acc}.icon-vs-bg{fill:#424242}.icon-vs-green{fill:#393}.st0{fill:url(#path1948_1_)}.st1{fill:url(#path1950_1_)}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-visualstudio-online" d="M30 4H2V2h28v2z"/><path class="icon-vso-bg" d="M29 4v21H3V4H2v22h28V4z"/><path class="icon-vs-bg" d="M10 4H3v21h26V4z"/></g><g id="iconFg"><path class="icon-white" d="M29.141 3l.429.429-.14.142-.43-.43-.43.43-.14-.142.429-.429-.429-.429.141-.142.429.43.43-.43.141.142-.43.429zM27.6 2.4h-1.2v1.2h1.2V2.4zm-1 .2h.8v.8h-.8v-.8zm-1.139.8h-1v.2h1v-.2z"/><path class="icon-vs-green" d="M16 14H5v-1h11.031c-.014.044-.031 1-.031 1zm-4-5H5v1h7V9zm-7 8v1h8v-1H5z"/></g><g id="colorImportance"><path class="icon-white" d="M31.596 24.063C31.246 25.116 30.595 27 28.349 27H27v1.313c0 .905-.368 2.537-2.996 3.298-.904.261-1.728.389-2.566.389-.83 0-1.597-.128-2.492-.392C17.029 31.045 16 29.844 16 28.313V27h-1.297c-1.698 0-2.943-1.141-3.416-3.11-.469-1.946-.469-3.021 0-4.967.451-1.881 1.96-2.923 3.845-2.923H16v-1.697c0-2.005.834-2.845 3.054-3.238.728-.128 1.474-.065 2.296-.065h.003c.921 0 1.735-.07 2.537.064 1.816.303 3.11 1.585 3.11 3.24V16h1.349c1.142 0 2.636.356 3.27 2.912.515 2.072.509 3.558-.023 5.151z"/><linearGradient id="path1948_1_" gradientUnits="userSpaceOnUse" x1="522.205" y1="-288.668" x2="540.902" y2="-304.754" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#5a9fd4"/><stop offset="1" stop-color="#306998"/></linearGradient><path id="path1948_3_" class="st0" d="M21.354 11.725c-.786.004-1.537.071-2.197.188-1.946.344-2.299 1.063-2.299 2.39v1.753h4.598v.584h-6.324c-1.336 0-2.507.803-2.873 2.331-.422 1.751-.441 2.844 0 4.673.327 1.361 1.107 2.331 2.444 2.331h1.581v-2.101c0-1.518 1.313-2.857 2.873-2.857h4.593c1.279 0 2.299-1.053 2.299-2.337v-4.379c0-1.246-1.051-2.182-2.299-2.39-.79-.13-1.61-.189-2.396-.186zm-2.486 1.41c.475 0 .863.394.863.879a.87.87 0 0 1-.863.874.868.868 0 0 1-.863-.874c0-.485.386-.879.863-.879z"/><linearGradient id="path1950_1_" gradientUnits="userSpaceOnUse" x1="548.13" y1="-314.489" x2="541.454" y2="-305.043" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#ffd43b"/><stop offset="1" stop-color="#ffe873"/></linearGradient><path id="path1950_3_" class="st1" d="M26.623 16.64v2.042c0 1.583-1.342 2.915-2.873 2.915h-4.593c-1.258 0-2.299 1.077-2.299 2.337v4.379c0 1.246 1.084 1.979 2.299 2.337 1.456.428 2.851.505 4.593 0 1.158-.335 2.299-1.01 2.299-2.337V26.56h-4.593v-.584h6.892c1.336 0 1.834-.932 2.299-2.331.48-1.44.46-2.826 0-4.673-.33-1.33-.961-2.331-2.299-2.331h-1.725zm-2.584 11.089c.477 0 .863.391.863.874a.871.871 0 0 1-.863.879.872.872 0 0 1-.863-.879.87.87 0 0 1 .863-.874z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-white{fill:#fff}.icon-visualstudio-online{fill:#007acc}.graph-lightgrey{fill:#dfdfdf}.st0{fill:#f6f6f6}.st1{fill:#656565}.st2{fill:#bfbfbf}.st3{fill:#fff}.st4{fill:url(#path1948_1_)}.st5{fill:url(#path1950_1_)}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="graph-lightgrey" d="M29 7H3V5h26v2z"/><path class="icon-visualstudio-online" d="M30 5H2V3h28v2z"/><path class="icon-white" d="M29.141 4l.429.429-.14.142-.43-.43-.43.43-.14-.142.429-.429-.429-.429.141-.142.429.43.43-.43.141.142-.43.429zM27.6 3.4h-1.2v1.2h1.2V3.4zm-1 .2h.8v.8h-.8v-.8zm-1.139.8h-1v.2h1v-.2z"/><path class="st0" d="M3 7h26v19H3z"/><path class="st1" d="M29 5v21H3V5H2v22h28V5z"/><path class="st1" d="M4 5.75h2v.5H4z"/></g><path class="st2" d="M12 11H5v-1h7v1zm-7 7v1h11v-1H5zm0-4v1h11v-1H5z" id="iconFg"/><g id="colorImportance"><path class="st3" d="M31.618 18.912C30.984 16.356 29.49 16 28.349 16H27v-1.697c0-1.654-1.294-2.937-3.11-3.24-.802-.133-1.617-.063-2.537-.063h-.003c-.821 0-1.568-.063-2.295.065-2.221.393-3.055 1.233-3.055 3.238V16h-.868c-1.885 0-3.394 1.042-3.845 2.924-.469 1.946-.469 3.022 0 4.967C11.76 25.859 13.005 27 14.703 27H16v1.313c0 1.531 1.029 2.732 2.946 3.296.896.263 1.662.391 2.492.391.838 0 1.661-.128 2.565-.39C26.632 30.85 27 29.218 27 28.313V27h1.349c2.246 0 2.897-1.884 3.247-2.937.532-1.592.538-3.079.022-5.151z"/><linearGradient id="path1948_1_" gradientUnits="userSpaceOnUse" x1="522.205" y1="-288.668" x2="540.902" y2="-304.754" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#5a9fd4"/><stop offset="1" stop-color="#306998"/></linearGradient><path id="path1948_6_" class="st4" d="M21.354 11.725c-.786.004-1.537.071-2.197.188-1.946.344-2.299 1.063-2.299 2.39v1.753h4.598v.584h-6.324c-1.336 0-2.507.803-2.873 2.331-.422 1.751-.441 2.844 0 4.673.327 1.361 1.107 2.331 2.444 2.331h1.581v-2.101c0-1.518 1.313-2.857 2.873-2.857h4.593c1.278 0 2.299-1.053 2.299-2.337v-4.379c0-1.246-1.051-2.182-2.299-2.39-.79-.13-1.61-.189-2.396-.186zm-2.486 1.41c.475 0 .863.394.863.879a.87.87 0 0 1-.863.874.868.868 0 0 1-.863-.874c0-.485.386-.879.863-.879z"/><linearGradient id="path1950_1_" gradientUnits="userSpaceOnUse" x1="548.13" y1="-314.489" x2="541.454" y2="-305.043" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#ffd43b"/><stop offset="1" stop-color="#ffe873"/></linearGradient><path id="path1950_6_" class="st5" d="M26.623 16.64v2.042c0 1.583-1.342 2.915-2.873 2.915h-4.593c-1.258 0-2.299 1.077-2.299 2.337v4.379c0 1.246 1.084 1.979 2.299 2.337 1.456.428 2.851.505 4.593 0 1.158-.335 2.299-1.01 2.299-2.337V26.56h-4.593v-.584h6.892c1.336 0 1.834-.932 2.299-2.331.48-1.44.46-2.826 0-4.673-.33-1.33-.961-2.331-2.299-2.331h-1.725zm-2.584 11.089c.477 0 .863.391.863.874a.871.871 0 0 1-.863.879.872.872 0 0 1-.863-.879.87.87 0 0 1 .863-.874z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-visualstudio-online{fill:#007acc}.icon-disabled-grey{fill:#848484}.icon-white{fill:#fff}.st0{fill:#f0eff1}.st1{fill:#424242}.st2{fill:url(#path1948_1_)}.st3{fill:url(#path1950_1_)}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="st0" d="M18 8v10H1V8h17zm-1.191 15.572a1.004 1.004 0 0 0-.903-.572H2.907c-.385 0-.74.225-.903.572L.886 25.928A.748.748 0 0 0 1.563 27H17.25a.748.748 0 0 0 .677-1.072l-1.118-2.356z"/><path class="icon-disabled-grey" d="M17.927 25.929l-1.118-2.356a1.003 1.003 0 0 0-.903-.573H2.907c-.385 0-.74.225-.903.572L.886 25.928A.748.748 0 0 0 1.563 27H17.25a.747.747 0 0 0 .633-.349.746.746 0 0 0 .044-.722zM1.959 26l.949-2h12.998l.949 2H1.959zM6 22v-1h3v-2h1v2h3v1H6z"/><path class="st1" d="M0 7v12h19V7H0zm18 11H1V8h17v10z"/></g><g id="iconFg"><path class="icon-white" d="M12 6V0H7v6H2.755L9.5 13.495 16.245 6z"/><path class="icon-visualstudio-online" d="M8 4h3v3h3l-4.5 5L5 7h3V4zm3-2H8v1h3V2zm0-2H8v1h3V0z"/></g><g id="colorImportance"><path class="icon-white" d="M31.596 24.063C31.246 25.116 30.595 27 28.349 27H27v1.313c0 .905-.368 2.537-2.997 3.298-.903.261-1.727.389-2.565.389-.83 0-1.597-.128-2.493-.392C17.029 31.045 16 29.844 16 28.313V27h-1.296c-1.698 0-2.944-1.141-3.417-3.11-.469-1.944-.469-3.02 0-4.967.451-1.881 1.961-2.923 3.845-2.923H16v-1.697c0-2.005.834-2.845 3.054-3.238.728-.128 1.474-.065 2.296-.065h.003c.921 0 1.735-.07 2.537.064 1.816.303 3.11 1.585 3.11 3.24V16h1.349c1.142 0 2.636.356 3.27 2.912.515 2.072.509 3.559-.023 5.151z"/><linearGradient id="path1948_1_" gradientUnits="userSpaceOnUse" x1="522.205" y1="-288.668" x2="540.902" y2="-304.754" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#5a9fd4"/><stop offset="1" stop-color="#306998"/></linearGradient><path id="path1948_9_" class="st2" d="M21.354 11.725c-.786.004-1.537.071-2.197.188-1.946.344-2.299 1.063-2.299 2.39v1.753h4.598v.584h-6.324c-1.336 0-2.507.803-2.873 2.331-.422 1.751-.441 2.844 0 4.673.327 1.361 1.108 2.331 2.444 2.331h1.581v-2.101c0-1.518 1.313-2.857 2.873-2.857h4.593c1.279 0 2.299-1.053 2.299-2.337v-4.379c0-1.246-1.051-2.182-2.299-2.39-.79-.13-1.61-.189-2.396-.186zm-2.486 1.41c.475 0 .863.394.863.879a.87.87 0 0 1-.863.874.868.868 0 0 1-.863-.874c0-.485.386-.879.863-.879z"/><linearGradient id="path1950_1_" gradientUnits="userSpaceOnUse" x1="548.13" y1="-314.489" x2="541.454" y2="-305.043" gradientTransform="matrix(.5625 0 0 -.568 -282.272 -151.69)"><stop offset="0" stop-color="#ffd43b"/><stop offset="1" stop-color="#ffe873"/></linearGradient><path id="path1950_9_" class="st3" d="M26.623 16.64v2.042c0 1.583-1.342 2.915-2.873 2.915h-4.593c-1.258 0-2.299 1.077-2.299 2.337v4.379c0 1.246 1.084 1.979 2.299 2.337 1.456.428 2.851.505 4.593 0 1.158-.335 2.299-1.01 2.299-2.337V26.56h-4.593v-.584H28.348c1.336 0 1.834-.932 2.299-2.331.48-1.44.46-2.826 0-4.673-.33-1.33-.961-2.331-2.299-2.331h-1.725zm-2.584 11.089c.477 0 .863.391.863.874a.871.871 0 0 1-.863.879.872.872 0 0 1-.863-.879.87.87 0 0 1 .863-.874z"/></g></svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,22 @@
#ifdef _MSC_VER
#include <stdlib.h>
#if _MSC_VER >= 1900
/* pyconfig.h uses this function in the _Py_BEGIN/END_SUPPRESS_IPH
* macros. It does not need to be defined when building using MSVC
* earlier than 14.0 (_MSC_VER == 1900).
*/
static void __cdecl _silent_invalid_parameter_handler(
wchar_t const* expression,
wchar_t const* function,
wchar_t const* file,
unsigned int line,
uintptr_t pReserved) { }
_invalid_parameter_handler _Py_silent_invalid_parameter_handler = _silent_invalid_parameter_handler;
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
import sys
try:
import layout
except ImportError:
# Failed to import our package, which likely means we were started directly
# Add the additional search path needed to locate our module.
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from layout.main import main
sys.exit(int(main() or 0))

View File

@ -0,0 +1,656 @@
"""
Generates a layout of Python for Windows from a build.
See python make_layout.py --help for usage.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import argparse
import functools
import os
import re
import shutil
import subprocess
import sys
import tempfile
import zipfile
from pathlib import Path
if __name__ == "__main__":
# Started directly, so enable relative imports
__path__ = [str(Path(__file__).resolve().parent)]
from .support.appxmanifest import *
from .support.catalog import *
from .support.constants import *
from .support.filesets import *
from .support.logging import *
from .support.options import *
from .support.pip import *
from .support.props import *
from .support.nuspec import *
BDIST_WININST_FILES_ONLY = FileNameSet("wininst-*", "bdist_wininst.py")
BDIST_WININST_STUB = "PC/layout/support/distutils.command.bdist_wininst.py"
TEST_PYDS_ONLY = FileStemSet("xxlimited", "_ctypes_test", "_test*")
TEST_DIRS_ONLY = FileNameSet("test", "tests")
IDLE_DIRS_ONLY = FileNameSet("idlelib")
TCLTK_PYDS_ONLY = FileStemSet("tcl*", "tk*", "_tkinter")
TCLTK_DIRS_ONLY = FileNameSet("tkinter", "turtledemo")
TCLTK_FILES_ONLY = FileNameSet("turtle.py")
VENV_DIRS_ONLY = FileNameSet("venv", "ensurepip")
EXCLUDE_FROM_PYDS = FileStemSet("python*", "pyshellext", "vcruntime*")
EXCLUDE_FROM_LIB = FileNameSet("*.pyc", "__pycache__", "*.pickle")
EXCLUDE_FROM_PACKAGED_LIB = FileNameSet("readme.txt")
EXCLUDE_FROM_COMPILE = FileNameSet("badsyntax_*", "bad_*")
EXCLUDE_FROM_CATALOG = FileSuffixSet(".exe", ".pyd", ".dll")
REQUIRED_DLLS = FileStemSet("libcrypto*", "libssl*", "libffi*")
LIB2TO3_GRAMMAR_FILES = FileNameSet("Grammar.txt", "PatternGrammar.txt")
PY_FILES = FileSuffixSet(".py")
PYC_FILES = FileSuffixSet(".pyc")
CAT_FILES = FileSuffixSet(".cat")
CDF_FILES = FileSuffixSet(".cdf")
DATA_DIRS = FileNameSet("data")
TOOLS_DIRS = FileNameSet("scripts", "i18n", "pynche", "demo", "parser")
TOOLS_FILES = FileSuffixSet(".py", ".pyw", ".txt")
def copy_if_modified(src, dest):
try:
dest_stat = os.stat(dest)
except FileNotFoundError:
do_copy = True
else:
src_stat = os.stat(src)
do_copy = (
src_stat.st_mtime != dest_stat.st_mtime
or src_stat.st_size != dest_stat.st_size
)
if do_copy:
shutil.copy2(src, dest)
def get_lib_layout(ns):
def _c(f):
if f in EXCLUDE_FROM_LIB:
return False
if f.is_dir():
if f in TEST_DIRS_ONLY:
return ns.include_tests
if f in TCLTK_DIRS_ONLY:
return ns.include_tcltk
if f in IDLE_DIRS_ONLY:
return ns.include_idle
if f in VENV_DIRS_ONLY:
return ns.include_venv
else:
if f in TCLTK_FILES_ONLY:
return ns.include_tcltk
if f in BDIST_WININST_FILES_ONLY:
return ns.include_bdist_wininst
return True
for dest, src in rglob(ns.source / "Lib", "**/*", _c):
yield dest, src
if not ns.include_bdist_wininst:
src = ns.source / BDIST_WININST_STUB
yield Path("distutils/command/bdist_wininst.py"), src
def get_tcltk_lib(ns):
if not ns.include_tcltk:
return
tcl_lib = os.getenv("TCL_LIBRARY")
if not tcl_lib or not os.path.isdir(tcl_lib):
try:
with open(ns.build / "TCL_LIBRARY.env", "r", encoding="utf-8-sig") as f:
tcl_lib = f.read().strip()
except FileNotFoundError:
pass
if not tcl_lib or not os.path.isdir(tcl_lib):
log_warning("Failed to find TCL_LIBRARY")
return
for dest, src in rglob(Path(tcl_lib).parent, "**/*"):
yield "tcl/{}".format(dest), src
def get_layout(ns):
def in_build(f, dest="", new_name=None):
n, _, x = f.rpartition(".")
n = new_name or n
src = ns.build / f
if ns.debug and src not in REQUIRED_DLLS:
if not src.stem.endswith("_d"):
src = src.parent / (src.stem + "_d" + src.suffix)
if not n.endswith("_d"):
n += "_d"
f = n + "." + x
yield dest + n + "." + x, src
if ns.include_symbols:
pdb = src.with_suffix(".pdb")
if pdb.is_file():
yield dest + n + ".pdb", pdb
if ns.include_dev:
lib = src.with_suffix(".lib")
if lib.is_file():
yield "libs/" + n + ".lib", lib
if ns.include_appxmanifest:
yield from in_build("python_uwp.exe", new_name="python{}".format(VER_DOT))
yield from in_build("pythonw_uwp.exe", new_name="pythonw{}".format(VER_DOT))
# For backwards compatibility, but we don't reference these ourselves.
yield from in_build("python_uwp.exe", new_name="python")
yield from in_build("pythonw_uwp.exe", new_name="pythonw")
else:
yield from in_build("python.exe", new_name="python")
yield from in_build("pythonw.exe", new_name="pythonw")
yield from in_build(PYTHON_DLL_NAME)
if ns.include_launchers and ns.include_appxmanifest:
if ns.include_pip:
yield from in_build("python_uwp.exe", new_name="pip{}".format(VER_DOT))
if ns.include_idle:
yield from in_build("pythonw_uwp.exe", new_name="idle{}".format(VER_DOT))
if ns.include_stable:
yield from in_build(PYTHON_STABLE_DLL_NAME)
found_any = False
for dest, src in rglob(ns.build, "vcruntime*.dll"):
found_any = True
yield dest, src
if not found_any:
log_error("Failed to locate vcruntime DLL in the build.")
yield "LICENSE.txt", ns.build / "LICENSE.txt"
for dest, src in rglob(ns.build, ("*.pyd", "*.dll")):
if src.stem.endswith("_d") != bool(ns.debug) and src not in REQUIRED_DLLS:
continue
if src in EXCLUDE_FROM_PYDS:
continue
if src in TEST_PYDS_ONLY and not ns.include_tests:
continue
if src in TCLTK_PYDS_ONLY and not ns.include_tcltk:
continue
yield from in_build(src.name, dest="" if ns.flat_dlls else "DLLs/")
if ns.zip_lib:
zip_name = PYTHON_ZIP_NAME
yield zip_name, ns.temp / zip_name
else:
for dest, src in get_lib_layout(ns):
yield "Lib/{}".format(dest), src
if ns.include_venv:
yield from in_build("venvlauncher.exe", "Lib/venv/scripts/nt/", "python")
yield from in_build("venvwlauncher.exe", "Lib/venv/scripts/nt/", "pythonw")
if ns.include_tools:
def _c(d):
if d.is_dir():
return d in TOOLS_DIRS
return d in TOOLS_FILES
for dest, src in rglob(ns.source / "Tools", "**/*", _c):
yield "Tools/{}".format(dest), src
if ns.include_underpth:
yield PYTHON_PTH_NAME, ns.temp / PYTHON_PTH_NAME
if ns.include_dev:
for dest, src in rglob(ns.source / "Include", "**/*.h"):
yield "include/{}".format(dest), src
src = ns.source / "PC" / "pyconfig.h"
yield "include/pyconfig.h", src
for dest, src in get_tcltk_lib(ns):
yield dest, src
if ns.include_pip:
for dest, src in get_pip_layout(ns):
if not isinstance(src, tuple) and (
src in EXCLUDE_FROM_LIB or src in EXCLUDE_FROM_PACKAGED_LIB
):
continue
yield dest, src
if ns.include_chm:
for dest, src in rglob(ns.doc_build / "htmlhelp", PYTHON_CHM_NAME):
yield "Doc/{}".format(dest), src
if ns.include_html_doc:
for dest, src in rglob(ns.doc_build / "html", "**/*"):
yield "Doc/html/{}".format(dest), src
if ns.include_props:
for dest, src in get_props_layout(ns):
yield dest, src
if ns.include_nuspec:
for dest, src in get_nuspec_layout(ns):
yield dest, src
for dest, src in get_appx_layout(ns):
yield dest, src
if ns.include_cat:
if ns.flat_dlls:
yield ns.include_cat.name, ns.include_cat
else:
yield "DLLs/{}".format(ns.include_cat.name), ns.include_cat
def _compile_one_py(src, dest, name, optimize, checked=True):
import py_compile
if dest is not None:
dest = str(dest)
mode = (
py_compile.PycInvalidationMode.CHECKED_HASH
if checked
else py_compile.PycInvalidationMode.UNCHECKED_HASH
)
try:
return Path(
py_compile.compile(
str(src),
dest,
str(name),
doraise=True,
optimize=optimize,
invalidation_mode=mode,
)
)
except py_compile.PyCompileError:
log_warning("Failed to compile {}", src)
return None
# name argument added to address bpo-37641
def _py_temp_compile(src, name, ns, dest_dir=None, checked=True):
if not ns.precompile or src not in PY_FILES or src.parent in DATA_DIRS:
return None
dest = (dest_dir or ns.temp) / (src.stem + ".pyc")
return _compile_one_py(src, dest, name, optimize=2, checked=checked)
def _write_to_zip(zf, dest, src, ns, checked=True):
pyc = _py_temp_compile(src, dest, ns, checked=checked)
if pyc:
try:
zf.write(str(pyc), dest.with_suffix(".pyc"))
finally:
try:
pyc.unlink()
except:
log_exception("Failed to delete {}", pyc)
return
if src in LIB2TO3_GRAMMAR_FILES:
from lib2to3.pgen2.driver import load_grammar
tmp = ns.temp / src.name
try:
shutil.copy(src, tmp)
load_grammar(str(tmp))
for f in ns.temp.glob(src.stem + "*.pickle"):
zf.write(str(f), str(dest.parent / f.name))
try:
f.unlink()
except:
log_exception("Failed to delete {}", f)
except:
log_exception("Failed to compile {}", src)
finally:
try:
tmp.unlink()
except:
log_exception("Failed to delete {}", tmp)
zf.write(str(src), str(dest))
def generate_source_files(ns):
if ns.zip_lib:
zip_name = PYTHON_ZIP_NAME
zip_path = ns.temp / zip_name
if zip_path.is_file():
zip_path.unlink()
elif zip_path.is_dir():
log_error(
"Cannot create zip file because a directory exists by the same name"
)
return
log_info("Generating {} in {}", zip_name, ns.temp)
ns.temp.mkdir(parents=True, exist_ok=True)
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf:
for dest, src in get_lib_layout(ns):
_write_to_zip(zf, dest, src, ns, checked=False)
if ns.include_underpth:
log_info("Generating {} in {}", PYTHON_PTH_NAME, ns.temp)
ns.temp.mkdir(parents=True, exist_ok=True)
with open(ns.temp / PYTHON_PTH_NAME, "w", encoding="utf-8") as f:
if ns.zip_lib:
print(PYTHON_ZIP_NAME, file=f)
if ns.include_pip:
print("packages", file=f)
else:
print("Lib", file=f)
print("Lib/site-packages", file=f)
if not ns.flat_dlls:
print("DLLs", file=f)
print(".", file=f)
print(file=f)
print("# Uncomment to run site.main() automatically", file=f)
print("#import site", file=f)
if ns.include_pip:
log_info("Extracting pip")
extract_pip_files(ns)
def _create_zip_file(ns):
if not ns.zip:
return None
if ns.zip.is_file():
try:
ns.zip.unlink()
except OSError:
log_exception("Unable to remove {}", ns.zip)
sys.exit(8)
elif ns.zip.is_dir():
log_error("Cannot create ZIP file because {} is a directory", ns.zip)
sys.exit(8)
ns.zip.parent.mkdir(parents=True, exist_ok=True)
return zipfile.ZipFile(ns.zip, "w", zipfile.ZIP_DEFLATED)
def copy_files(files, ns):
if ns.copy:
ns.copy.mkdir(parents=True, exist_ok=True)
try:
total = len(files)
except TypeError:
total = None
count = 0
zip_file = _create_zip_file(ns)
try:
need_compile = []
in_catalog = []
for dest, src in files:
count += 1
if count % 10 == 0:
if total:
log_info("Processed {:>4} of {} files", count, total)
else:
log_info("Processed {} files", count)
log_debug("Processing {!s}", src)
if isinstance(src, tuple):
src, content = src
if ns.copy:
log_debug("Copy {} -> {}", src, ns.copy / dest)
(ns.copy / dest).parent.mkdir(parents=True, exist_ok=True)
with open(ns.copy / dest, "wb") as f:
f.write(content)
if ns.zip:
log_debug("Zip {} into {}", src, ns.zip)
zip_file.writestr(str(dest), content)
continue
if (
ns.precompile
and src in PY_FILES
and src not in EXCLUDE_FROM_COMPILE
and src.parent not in DATA_DIRS
and os.path.normcase(str(dest)).startswith(os.path.normcase("Lib"))
):
if ns.copy:
need_compile.append((dest, ns.copy / dest))
else:
(ns.temp / "Lib" / dest).parent.mkdir(parents=True, exist_ok=True)
copy_if_modified(src, ns.temp / "Lib" / dest)
need_compile.append((dest, ns.temp / "Lib" / dest))
if src not in EXCLUDE_FROM_CATALOG:
in_catalog.append((src.name, src))
if ns.copy:
log_debug("Copy {} -> {}", src, ns.copy / dest)
(ns.copy / dest).parent.mkdir(parents=True, exist_ok=True)
try:
copy_if_modified(src, ns.copy / dest)
except shutil.SameFileError:
pass
if ns.zip:
log_debug("Zip {} into {}", src, ns.zip)
zip_file.write(src, str(dest))
if need_compile:
for dest, src in need_compile:
compiled = [
_compile_one_py(src, None, dest, optimize=0),
_compile_one_py(src, None, dest, optimize=1),
_compile_one_py(src, None, dest, optimize=2),
]
for c in compiled:
if not c:
continue
cdest = Path(dest).parent / Path(c).relative_to(src.parent)
if ns.zip:
log_debug("Zip {} into {}", c, ns.zip)
zip_file.write(c, str(cdest))
in_catalog.append((cdest.name, cdest))
if ns.catalog:
# Just write out the CDF now. Compilation and signing is
# an extra step
log_info("Generating {}", ns.catalog)
ns.catalog.parent.mkdir(parents=True, exist_ok=True)
write_catalog(ns.catalog, in_catalog)
finally:
if zip_file:
zip_file.close()
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", help="Increase verbosity", action="count")
parser.add_argument(
"-s",
"--source",
metavar="dir",
help="The directory containing the repository root",
type=Path,
default=None,
)
parser.add_argument(
"-b", "--build", metavar="dir", help="Specify the build directory", type=Path
)
parser.add_argument(
"--arch",
metavar="architecture",
help="Specify the target architecture",
type=str,
default=None,
)
parser.add_argument(
"--doc-build",
metavar="dir",
help="Specify the docs build directory",
type=Path,
default=None,
)
parser.add_argument(
"--copy",
metavar="directory",
help="The name of the directory to copy an extracted layout to",
type=Path,
default=None,
)
parser.add_argument(
"--zip",
metavar="file",
help="The ZIP file to write all files to",
type=Path,
default=None,
)
parser.add_argument(
"--catalog",
metavar="file",
help="The CDF file to write catalog entries to",
type=Path,
default=None,
)
parser.add_argument(
"--log",
metavar="file",
help="Write all operations to the specified file",
type=Path,
default=None,
)
parser.add_argument(
"-t",
"--temp",
metavar="file",
help="A temporary working directory",
type=Path,
default=None,
)
parser.add_argument(
"-d", "--debug", help="Include debug build", action="store_true"
)
parser.add_argument(
"-p",
"--precompile",
help="Include .pyc files instead of .py",
action="store_true",
)
parser.add_argument(
"-z", "--zip-lib", help="Include library in a ZIP file", action="store_true"
)
parser.add_argument(
"--flat-dlls", help="Does not create a DLLs directory", action="store_true"
)
parser.add_argument(
"-a",
"--include-all",
help="Include all optional components",
action="store_true",
)
parser.add_argument(
"--include-cat",
metavar="file",
help="Specify the catalog file to include",
type=Path,
default=None,
)
for opt, help in get_argparse_options():
parser.add_argument(opt, help=help, action="store_true")
ns = parser.parse_args()
update_presets(ns)
ns.source = ns.source or (Path(__file__).resolve().parent.parent.parent)
ns.build = ns.build or Path(sys.executable).parent
ns.temp = ns.temp or Path(tempfile.mkdtemp())
ns.doc_build = ns.doc_build or (ns.source / "Doc" / "build")
if not ns.source.is_absolute():
ns.source = (Path.cwd() / ns.source).resolve()
if not ns.build.is_absolute():
ns.build = (Path.cwd() / ns.build).resolve()
if not ns.temp.is_absolute():
ns.temp = (Path.cwd() / ns.temp).resolve()
if not ns.doc_build.is_absolute():
ns.doc_build = (Path.cwd() / ns.doc_build).resolve()
if ns.include_cat and not ns.include_cat.is_absolute():
ns.include_cat = (Path.cwd() / ns.include_cat).resolve()
if not ns.arch:
ns.arch = "amd64" if sys.maxsize > 2 ** 32 else "win32"
if ns.copy and not ns.copy.is_absolute():
ns.copy = (Path.cwd() / ns.copy).resolve()
if ns.zip and not ns.zip.is_absolute():
ns.zip = (Path.cwd() / ns.zip).resolve()
if ns.catalog and not ns.catalog.is_absolute():
ns.catalog = (Path.cwd() / ns.catalog).resolve()
configure_logger(ns)
log_info(
"""OPTIONS
Source: {ns.source}
Build: {ns.build}
Temp: {ns.temp}
Arch: {ns.arch}
Copy to: {ns.copy}
Zip to: {ns.zip}
Catalog: {ns.catalog}""",
ns=ns,
)
if ns.arch not in ("win32", "amd64", "arm32", "arm64"):
log_error("--arch is not a valid value (win32, amd64, arm32, arm64)")
return 4
if ns.arch in ("arm32", "arm64"):
for n in ("include_idle", "include_tcltk"):
if getattr(ns, n):
log_warning(f"Disabling --{n.replace('_', '-')} on unsupported platform")
setattr(ns, n, False)
if ns.include_idle and not ns.include_tcltk:
log_warning("Assuming --include-tcltk to support --include-idle")
ns.include_tcltk = True
try:
generate_source_files(ns)
files = list(get_layout(ns))
copy_files(files, ns)
except KeyboardInterrupt:
log_info("Interrupted by Ctrl+C")
return 3
except SystemExit:
raise
except:
log_exception("Unhandled error")
if error_was_logged():
log_error("Errors occurred.")
return 1
if __name__ == "__main__":
sys.exit(int(main() or 0))

View File

@ -0,0 +1,511 @@
"""
File generation for APPX/MSIX manifests.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import collections
import ctypes
import io
import os
import sys
from pathlib import Path, PureWindowsPath
from xml.etree import ElementTree as ET
from .constants import *
__all__ = ["get_appx_layout"]
APPX_DATA = dict(
Name="PythonSoftwareFoundation.Python.{}".format(VER_DOT),
Version="{}.{}.{}.0".format(VER_MAJOR, VER_MINOR, VER_FIELD3),
Publisher=os.getenv(
"APPX_DATA_PUBLISHER", "CN=4975D53F-AA7E-49A5-8B49-EA4FDC1BB66B"
),
DisplayName="Python {}".format(VER_DOT),
Description="The Python {} runtime and console.".format(VER_DOT),
)
APPX_PLATFORM_DATA = dict(
_keys=("ProcessorArchitecture",),
win32=("x86",),
amd64=("x64",),
arm32=("arm",),
arm64=("arm64",),
)
PYTHON_VE_DATA = dict(
DisplayName="Python {}".format(VER_DOT),
Description="Python interactive console",
Square150x150Logo="_resources/pythonx150.png",
Square44x44Logo="_resources/pythonx44.png",
BackgroundColor="transparent",
)
PYTHONW_VE_DATA = dict(
DisplayName="Python {} (Windowed)".format(VER_DOT),
Description="Python windowed app launcher",
Square150x150Logo="_resources/pythonwx150.png",
Square44x44Logo="_resources/pythonwx44.png",
BackgroundColor="transparent",
AppListEntry="none",
)
PIP_VE_DATA = dict(
DisplayName="pip (Python {})".format(VER_DOT),
Description="pip package manager for Python {}".format(VER_DOT),
Square150x150Logo="_resources/pythonx150.png",
Square44x44Logo="_resources/pythonx44.png",
BackgroundColor="transparent",
AppListEntry="none",
)
IDLE_VE_DATA = dict(
DisplayName="IDLE (Python {})".format(VER_DOT),
Description="IDLE editor for Python {}".format(VER_DOT),
Square150x150Logo="_resources/idlex150.png",
Square44x44Logo="_resources/idlex44.png",
BackgroundColor="transparent",
)
PY_PNG = "_resources/py.png"
APPXMANIFEST_NS = {
"": "http://schemas.microsoft.com/appx/manifest/foundation/windows10",
"m": "http://schemas.microsoft.com/appx/manifest/foundation/windows10",
"uap": "http://schemas.microsoft.com/appx/manifest/uap/windows10",
"rescap": "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities",
"rescap4": "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/4",
"desktop4": "http://schemas.microsoft.com/appx/manifest/desktop/windows10/4",
"desktop6": "http://schemas.microsoft.com/appx/manifest/desktop/windows10/6",
"uap3": "http://schemas.microsoft.com/appx/manifest/uap/windows10/3",
"uap4": "http://schemas.microsoft.com/appx/manifest/uap/windows10/4",
"uap5": "http://schemas.microsoft.com/appx/manifest/uap/windows10/5",
}
APPXMANIFEST_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:rescap4="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/4"
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5">
<Identity Name=""
Version=""
Publisher=""
ProcessorArchitecture="" />
<Properties>
<DisplayName></DisplayName>
<PublisherDisplayName>Python Software Foundation</PublisherDisplayName>
<Description></Description>
<Logo>_resources/pythonx50.png</Logo>
</Properties>
<Resources>
<Resource Language="en-US" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust"/>
</Capabilities>
<Applications>
</Applications>
<Extensions>
</Extensions>
</Package>"""
RESOURCES_XML_TEMPLATE = r"""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--This file is input for makepri.exe. It should be excluded from the final package.-->
<resources targetOsVersion="10.0.0" majorVersion="1">
<packaging>
<autoResourcePackage qualifier="Language"/>
<autoResourcePackage qualifier="Scale"/>
<autoResourcePackage qualifier="DXFeatureLevel"/>
</packaging>
<index root="\" startIndexAt="\">
<default>
<qualifier name="Language" value="en-US"/>
<qualifier name="Contrast" value="standard"/>
<qualifier name="Scale" value="100"/>
<qualifier name="HomeRegion" value="001"/>
<qualifier name="TargetSize" value="256"/>
<qualifier name="LayoutDirection" value="LTR"/>
<qualifier name="Theme" value="dark"/>
<qualifier name="AlternateForm" value=""/>
<qualifier name="DXFeatureLevel" value="DX9"/>
<qualifier name="Configuration" value=""/>
<qualifier name="DeviceFamily" value="Universal"/>
<qualifier name="Custom" value=""/>
</default>
<indexer-config type="folder" foldernameAsQualifier="true" filenameAsQualifier="true" qualifierDelimiter="$"/>
<indexer-config type="resw" convertDotsToSlashes="true" initialPath=""/>
<indexer-config type="resjson" initialPath=""/>
<indexer-config type="PRI"/>
</index>
</resources>"""
SCCD_FILENAME = "PC/classicAppCompat.sccd"
SPECIAL_LOOKUP = object()
REGISTRY = {
"HKCU\\Software\\Python\\PythonCore": {
VER_DOT: {
"DisplayName": APPX_DATA["DisplayName"],
"SupportUrl": "https://www.python.org/",
"SysArchitecture": SPECIAL_LOOKUP,
"SysVersion": VER_DOT,
"Version": "{}.{}.{}".format(VER_MAJOR, VER_MINOR, VER_MICRO),
"InstallPath": {
"": "[{AppVPackageRoot}]",
"ExecutablePath": "[{{AppVPackageRoot}}]\\python{}.exe".format(VER_DOT),
"WindowedExecutablePath": "[{{AppVPackageRoot}}]\\pythonw{}.exe".format(
VER_DOT
),
},
"Help": {
"Main Python Documentation": {
"_condition": lambda ns: ns.include_chm,
"": "[{{AppVPackageRoot}}]\\Doc\\{}".format(PYTHON_CHM_NAME),
},
"Local Python Documentation": {
"_condition": lambda ns: ns.include_html_doc,
"": "[{AppVPackageRoot}]\\Doc\\html\\index.html",
},
"Online Python Documentation": {
"": "https://docs.python.org/{}".format(VER_DOT)
},
},
"Idle": {
"_condition": lambda ns: ns.include_idle,
"": "[{AppVPackageRoot}]\\Lib\\idlelib\\idle.pyw",
},
}
}
}
def get_packagefamilyname(name, publisher_id):
class PACKAGE_ID(ctypes.Structure):
_fields_ = [
("reserved", ctypes.c_uint32),
("processorArchitecture", ctypes.c_uint32),
("version", ctypes.c_uint64),
("name", ctypes.c_wchar_p),
("publisher", ctypes.c_wchar_p),
("resourceId", ctypes.c_wchar_p),
("publisherId", ctypes.c_wchar_p),
]
_pack_ = 4
pid = PACKAGE_ID(0, 0, 0, name, publisher_id, None, None)
result = ctypes.create_unicode_buffer(256)
result_len = ctypes.c_uint32(256)
r = ctypes.windll.kernel32.PackageFamilyNameFromId(
pid, ctypes.byref(result_len), result
)
if r:
raise OSError(r, "failed to get package family name")
return result.value[: result_len.value]
def _fixup_sccd(ns, sccd, new_hash=None):
if not new_hash:
return sccd
NS = dict(s="http://schemas.microsoft.com/appx/2016/sccd")
with open(sccd, "rb") as f:
xml = ET.parse(f)
pfn = get_packagefamilyname(APPX_DATA["Name"], APPX_DATA["Publisher"])
ae = xml.find("s:AuthorizedEntities", NS)
ae.clear()
e = ET.SubElement(ae, ET.QName(NS["s"], "AuthorizedEntity"))
e.set("AppPackageFamilyName", pfn)
e.set("CertificateSignatureHash", new_hash)
for e in xml.findall("s:Catalog", NS):
e.text = "FFFF"
sccd = ns.temp / sccd.name
sccd.parent.mkdir(parents=True, exist_ok=True)
with open(sccd, "wb") as f:
xml.write(f, encoding="utf-8")
return sccd
def find_or_add(xml, element, attr=None, always_add=False):
if always_add:
e = None
else:
q = element
if attr:
q += "[@{}='{}']".format(*attr)
e = xml.find(q, APPXMANIFEST_NS)
if e is None:
prefix, _, name = element.partition(":")
name = ET.QName(APPXMANIFEST_NS[prefix or ""], name)
e = ET.SubElement(xml, name)
if attr:
e.set(*attr)
return e
def _get_app(xml, appid):
if appid:
app = xml.find(
"m:Applications/m:Application[@Id='{}']".format(appid), APPXMANIFEST_NS
)
if app is None:
raise LookupError(appid)
else:
app = xml
return app
def add_visual(xml, appid, data):
app = _get_app(xml, appid)
e = find_or_add(app, "uap:VisualElements")
for i in data.items():
e.set(*i)
return e
def add_alias(xml, appid, alias, subsystem="windows"):
app = _get_app(xml, appid)
e = find_or_add(app, "m:Extensions")
e = find_or_add(e, "uap5:Extension", ("Category", "windows.appExecutionAlias"))
e = find_or_add(e, "uap5:AppExecutionAlias")
e.set(ET.QName(APPXMANIFEST_NS["desktop4"], "Subsystem"), subsystem)
e = find_or_add(e, "uap5:ExecutionAlias", ("Alias", alias))
def add_file_type(xml, appid, name, suffix, parameters='"%1"', info=None, logo=None):
app = _get_app(xml, appid)
e = find_or_add(app, "m:Extensions")
e = find_or_add(e, "uap3:Extension", ("Category", "windows.fileTypeAssociation"))
e = find_or_add(e, "uap3:FileTypeAssociation", ("Name", name))
e.set("Parameters", parameters)
if info:
find_or_add(e, "uap:DisplayName").text = info
if logo:
find_or_add(e, "uap:Logo").text = logo
e = find_or_add(e, "uap:SupportedFileTypes")
if isinstance(suffix, str):
suffix = [suffix]
for s in suffix:
ET.SubElement(e, ET.QName(APPXMANIFEST_NS["uap"], "FileType")).text = s
def add_application(
ns, xml, appid, executable, aliases, visual_element, subsystem, file_types
):
node = xml.find("m:Applications", APPXMANIFEST_NS)
suffix = "_d.exe" if ns.debug else ".exe"
app = ET.SubElement(
node,
ET.QName(APPXMANIFEST_NS[""], "Application"),
{
"Id": appid,
"Executable": executable + suffix,
"EntryPoint": "Windows.FullTrustApplication",
ET.QName(APPXMANIFEST_NS["desktop4"], "SupportsMultipleInstances"): "true",
},
)
if visual_element:
add_visual(app, None, visual_element)
for alias in aliases:
add_alias(app, None, alias + suffix, subsystem)
if file_types:
add_file_type(app, None, *file_types)
return app
def _get_registry_entries(ns, root="", d=None):
r = root if root else PureWindowsPath("")
if d is None:
d = REGISTRY
for key, value in d.items():
if key == "_condition":
continue
if value is SPECIAL_LOOKUP:
if key == "SysArchitecture":
value = {
"win32": "32bit",
"amd64": "64bit",
"arm32": "32bit",
"arm64": "64bit",
}[ns.arch]
else:
raise ValueError(f"Key '{key}' unhandled for special lookup")
if isinstance(value, dict):
cond = value.get("_condition")
if cond and not cond(ns):
continue
fullkey = r
for part in PureWindowsPath(key).parts:
fullkey /= part
if len(fullkey.parts) > 1:
yield str(fullkey), None, None
yield from _get_registry_entries(ns, fullkey, value)
elif len(r.parts) > 1:
yield str(r), key, value
def add_registry_entries(ns, xml):
e = find_or_add(xml, "m:Extensions")
e = find_or_add(e, "rescap4:Extension")
e.set("Category", "windows.classicAppCompatKeys")
e.set("EntryPoint", "Windows.FullTrustApplication")
e = ET.SubElement(e, ET.QName(APPXMANIFEST_NS["rescap4"], "ClassicAppCompatKeys"))
for name, valuename, value in _get_registry_entries(ns):
k = ET.SubElement(
e, ET.QName(APPXMANIFEST_NS["rescap4"], "ClassicAppCompatKey")
)
k.set("Name", name)
if value:
k.set("ValueName", valuename)
k.set("Value", value)
k.set("ValueType", "REG_SZ")
def disable_registry_virtualization(xml):
e = find_or_add(xml, "m:Properties")
e = find_or_add(e, "desktop6:RegistryWriteVirtualization")
e.text = "disabled"
e = find_or_add(xml, "m:Capabilities")
e = find_or_add(e, "rescap:Capability", ("Name", "unvirtualizedResources"))
def get_appxmanifest(ns):
for k, v in APPXMANIFEST_NS.items():
ET.register_namespace(k, v)
ET.register_namespace("", APPXMANIFEST_NS["m"])
xml = ET.parse(io.StringIO(APPXMANIFEST_TEMPLATE))
NS = APPXMANIFEST_NS
QN = ET.QName
data = dict(APPX_DATA)
for k, v in zip(APPX_PLATFORM_DATA["_keys"], APPX_PLATFORM_DATA[ns.arch]):
data[k] = v
node = xml.find("m:Identity", NS)
for k in node.keys():
value = data.get(k)
if value:
node.set(k, value)
for node in xml.find("m:Properties", NS):
value = data.get(node.tag.rpartition("}")[2])
if value:
node.text = value
winver = sys.getwindowsversion()[:3]
if winver < (10, 0, 17763):
winver = 10, 0, 17763
find_or_add(xml, "m:Dependencies/m:TargetDeviceFamily").set(
"MaxVersionTested", "{}.{}.{}.0".format(*winver)
)
if winver > (10, 0, 17763):
disable_registry_virtualization(xml)
app = add_application(
ns,
xml,
"Python",
"python{}".format(VER_DOT),
["python", "python{}".format(VER_MAJOR), "python{}".format(VER_DOT)],
PYTHON_VE_DATA,
"console",
("python.file", [".py"], '"%1"', "Python File", PY_PNG),
)
add_application(
ns,
xml,
"PythonW",
"pythonw{}".format(VER_DOT),
["pythonw", "pythonw{}".format(VER_MAJOR), "pythonw{}".format(VER_DOT)],
PYTHONW_VE_DATA,
"windows",
("python.windowedfile", [".pyw"], '"%1"', "Python File (no console)", PY_PNG),
)
if ns.include_pip and ns.include_launchers:
add_application(
ns,
xml,
"Pip",
"pip{}".format(VER_DOT),
["pip", "pip{}".format(VER_MAJOR), "pip{}".format(VER_DOT)],
PIP_VE_DATA,
"console",
("python.wheel", [".whl"], 'install "%1"', "Python Wheel"),
)
if ns.include_idle and ns.include_launchers:
add_application(
ns,
xml,
"Idle",
"idle{}".format(VER_DOT),
["idle", "idle{}".format(VER_MAJOR), "idle{}".format(VER_DOT)],
IDLE_VE_DATA,
"windows",
None,
)
if (ns.source / SCCD_FILENAME).is_file():
add_registry_entries(ns, xml)
node = xml.find("m:Capabilities", NS)
node = ET.SubElement(node, QN(NS["uap4"], "CustomCapability"))
node.set("Name", "Microsoft.classicAppCompat_8wekyb3d8bbwe")
buffer = io.BytesIO()
xml.write(buffer, encoding="utf-8", xml_declaration=True)
return buffer.getbuffer()
def get_resources_xml(ns):
return RESOURCES_XML_TEMPLATE.encode("utf-8")
def get_appx_layout(ns):
if not ns.include_appxmanifest:
return
yield "AppxManifest.xml", ("AppxManifest.xml", get_appxmanifest(ns))
yield "_resources.xml", ("_resources.xml", get_resources_xml(ns))
icons = ns.source / "PC" / "icons"
for px in [44, 50, 150]:
src = icons / "pythonx{}.png".format(px)
yield f"_resources/pythonx{px}.png", src
yield f"_resources/pythonx{px}$targetsize-{px}_altform-unplated.png", src
for px in [44, 150]:
src = icons / "pythonwx{}.png".format(px)
yield f"_resources/pythonwx{px}.png", src
yield f"_resources/pythonwx{px}$targetsize-{px}_altform-unplated.png", src
if ns.include_idle and ns.include_launchers:
for px in [44, 150]:
src = icons / "idlex{}.png".format(px)
yield f"_resources/idlex{px}.png", src
yield f"_resources/idlex{px}$targetsize-{px}_altform-unplated.png", src
yield f"_resources/py.png", icons / "py.png"
sccd = ns.source / SCCD_FILENAME
if sccd.is_file():
# This should only be set for side-loading purposes.
sccd = _fixup_sccd(ns, sccd, os.getenv("APPX_DATA_SHA256"))
yield sccd.name, sccd

View File

@ -0,0 +1,44 @@
"""
File generation for catalog signing non-binary contents.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import sys
__all__ = ["PYTHON_CAT_NAME", "PYTHON_CDF_NAME"]
def public(f):
__all__.append(f.__name__)
return f
PYTHON_CAT_NAME = "python.cat"
PYTHON_CDF_NAME = "python.cdf"
CATALOG_TEMPLATE = r"""[CatalogHeader]
Name={target.stem}.cat
ResultDir={target.parent}
PublicVersion=1
CatalogVersion=2
HashAlgorithms=SHA256
PageHashes=false
EncodingType=
[CatalogFiles]
"""
def can_sign(file):
return file.is_file() and file.stat().st_size
@public
def write_catalog(target, files):
with target.open("w", encoding="utf-8") as cat:
cat.write(CATALOG_TEMPLATE.format(target=target))
cat.writelines("<HASH>{}={}\n".format(n, f) for n, f in files if can_sign(f))

View File

@ -0,0 +1,42 @@
"""
Constants for generating the layout.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import os
import re
import struct
import sys
def _unpack_hexversion():
try:
hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16)
except (TypeError, ValueError):
hexversion = sys.hexversion
return struct.pack(">i", sys.hexversion)
def _get_suffix(field4):
name = {0xA0: "a", 0xB0: "b", 0xC0: "rc"}.get(field4 & 0xF0, "")
if name:
serial = field4 & 0x0F
return f"{name}{serial}"
return ""
VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4 = _unpack_hexversion()
VER_SUFFIX = _get_suffix(VER_FIELD4)
VER_FIELD3 = VER_MICRO << 8 | VER_FIELD4
VER_DOT = "{}.{}".format(VER_MAJOR, VER_MINOR)
PYTHON_DLL_NAME = "python{}{}.dll".format(VER_MAJOR, VER_MINOR)
PYTHON_STABLE_DLL_NAME = "python{}.dll".format(VER_MAJOR)
PYTHON_ZIP_NAME = "python{}{}.zip".format(VER_MAJOR, VER_MINOR)
PYTHON_PTH_NAME = "python{}{}._pth".format(VER_MAJOR, VER_MINOR)
PYTHON_CHM_NAME = "python{}{}{}{}.chm".format(
VER_MAJOR, VER_MINOR, VER_MICRO, VER_SUFFIX
)

View File

@ -0,0 +1,25 @@
"""distutils.command.bdist_wininst
Suppress the 'bdist_wininst' command, while still allowing
setuptools to import it without breaking."""
from distutils.core import Command
from distutils.errors import DistutilsPlatformError
class bdist_wininst(Command):
description = "create an executable installer for MS Windows"
# Marker for tests that we have the unsupported bdist_wininst
_unsupported = True
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
raise DistutilsPlatformError(
"bdist_wininst is not supported in this Python distribution"
)

View File

@ -0,0 +1,100 @@
"""
File sets and globbing helper for make_layout.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import os
class FileStemSet:
def __init__(self, *patterns):
self._names = set()
self._prefixes = []
self._suffixes = []
for p in map(os.path.normcase, patterns):
if p.endswith("*"):
self._prefixes.append(p[:-1])
elif p.startswith("*"):
self._suffixes.append(p[1:])
else:
self._names.add(p)
def _make_name(self, f):
return os.path.normcase(f.stem)
def __contains__(self, f):
bn = self._make_name(f)
return (
bn in self._names
or any(map(bn.startswith, self._prefixes))
or any(map(bn.endswith, self._suffixes))
)
class FileNameSet(FileStemSet):
def _make_name(self, f):
return os.path.normcase(f.name)
class FileSuffixSet:
def __init__(self, *patterns):
self._names = set()
self._prefixes = []
self._suffixes = []
for p in map(os.path.normcase, patterns):
if p.startswith("*."):
self._names.add(p[1:])
elif p.startswith("*"):
self._suffixes.append(p[1:])
elif p.endswith("*"):
self._prefixes.append(p[:-1])
elif p.startswith("."):
self._names.add(p)
else:
self._names.add("." + p)
def _make_name(self, f):
return os.path.normcase(f.suffix)
def __contains__(self, f):
bn = self._make_name(f)
return (
bn in self._names
or any(map(bn.startswith, self._prefixes))
or any(map(bn.endswith, self._suffixes))
)
def _rglob(root, pattern, condition):
dirs = [root]
recurse = pattern[:3] in {"**/", "**\\"}
if recurse:
pattern = pattern[3:]
while dirs:
d = dirs.pop(0)
if recurse:
dirs.extend(
filter(
condition, (type(root)(f2) for f2 in os.scandir(d) if f2.is_dir())
)
)
yield from (
(f.relative_to(root), f)
for f in d.glob(pattern)
if f.is_file() and condition(f)
)
def _return_true(f):
return True
def rglob(root, patterns, condition=None):
if isinstance(patterns, tuple):
for p in patterns:
yield from _rglob(root, p, condition or _return_true)
else:
yield from _rglob(root, patterns, condition or _return_true)

View File

@ -0,0 +1,93 @@
"""
Logging support for make_layout.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import logging
import sys
__all__ = []
LOG = None
HAS_ERROR = False
def public(f):
__all__.append(f.__name__)
return f
@public
def configure_logger(ns):
global LOG
if LOG:
return
LOG = logging.getLogger("make_layout")
LOG.level = logging.DEBUG
if ns.v:
s_level = max(logging.ERROR - ns.v * 10, logging.DEBUG)
f_level = max(logging.WARNING - ns.v * 10, logging.DEBUG)
else:
s_level = logging.ERROR
f_level = logging.INFO
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(logging.Formatter("{levelname:8s} {message}", style="{"))
handler.setLevel(s_level)
LOG.addHandler(handler)
if ns.log:
handler = logging.FileHandler(ns.log, encoding="utf-8", delay=True)
handler.setFormatter(
logging.Formatter("[{asctime}]{levelname:8s}: {message}", style="{")
)
handler.setLevel(f_level)
LOG.addHandler(handler)
class BraceMessage:
def __init__(self, fmt, *args, **kwargs):
self.fmt = fmt
self.args = args
self.kwargs = kwargs
def __str__(self):
return self.fmt.format(*self.args, **self.kwargs)
@public
def log_debug(msg, *args, **kwargs):
return LOG.debug(BraceMessage(msg, *args, **kwargs))
@public
def log_info(msg, *args, **kwargs):
return LOG.info(BraceMessage(msg, *args, **kwargs))
@public
def log_warning(msg, *args, **kwargs):
return LOG.warning(BraceMessage(msg, *args, **kwargs))
@public
def log_error(msg, *args, **kwargs):
global HAS_ERROR
HAS_ERROR = True
return LOG.error(BraceMessage(msg, *args, **kwargs))
@public
def log_exception(msg, *args, **kwargs):
global HAS_ERROR
HAS_ERROR = True
return LOG.exception(BraceMessage(msg, *args, **kwargs))
@public
def error_was_logged():
return HAS_ERROR

View File

@ -0,0 +1,78 @@
"""
Provides .props file.
"""
import os
import sys
from .constants import *
__all__ = ["get_nuspec_layout"]
PYTHON_NUSPEC_NAME = "python.nuspec"
NUSPEC_DATA = {
"PYTHON_TAG": VER_DOT,
"PYTHON_VERSION": os.getenv("PYTHON_NUSPEC_VERSION"),
"FILELIST": r' <file src="**\*" exclude="python.png" target="tools" />',
"GIT": sys._git,
}
NUSPEC_PLATFORM_DATA = dict(
_keys=("PYTHON_BITNESS", "PACKAGENAME", "PACKAGETITLE"),
win32=("32-bit", "pythonx86", "Python (32-bit)"),
amd64=("64-bit", "python", "Python"),
arm32=("ARM", "pythonarm", "Python (ARM)"),
arm64=("ARM64", "pythonarm64", "Python (ARM64)"),
)
if not NUSPEC_DATA["PYTHON_VERSION"]:
NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}{}{}".format(
VER_DOT, VER_MICRO, "-" if VER_SUFFIX else "", VER_SUFFIX
)
FILELIST_WITH_PROPS = r""" <file src="**\*" exclude="python.png;python.props" target="tools" />
<file src="python.props" target="build\native" />"""
NUSPEC_TEMPLATE = r"""<?xml version="1.0"?>
<package>
<metadata>
<id>{PACKAGENAME}</id>
<title>{PACKAGETITLE}</title>
<version>{PYTHON_VERSION}</version>
<authors>Python Software Foundation</authors>
<license type="file">tools\LICENSE.txt</license>
<projectUrl>https://www.python.org/</projectUrl>
<description>Installs {PYTHON_BITNESS} Python for use in build scenarios.</description>
<icon>images\python.png</icon>
<iconUrl>https://www.python.org/static/favicon.ico</iconUrl>
<tags>python</tags>
<repository type="git" url="https://github.com/Python/CPython.git" commit="{GIT[2]}" />
</metadata>
<files>
<file src="python.png" target="images" />
{FILELIST}
</files>
</package>
"""
def _get_nuspec_data_overrides(ns):
for k, v in zip(NUSPEC_PLATFORM_DATA["_keys"], NUSPEC_PLATFORM_DATA[ns.arch]):
ev = os.getenv("PYTHON_NUSPEC_" + k)
if ev:
yield k, ev
yield k, v
def get_nuspec_layout(ns):
if ns.include_all or ns.include_nuspec:
data = dict(NUSPEC_DATA)
for k, v in _get_nuspec_data_overrides(ns):
if not data.get(k):
data[k] = v
if ns.include_all or ns.include_props:
data["FILELIST"] = FILELIST_WITH_PROPS
nuspec = NUSPEC_TEMPLATE.format_map(data)
yield "python.nuspec", ("python.nuspec", nuspec.encode("utf-8"))
yield "python.png", ns.source / "PC" / "icons" / "logox128.png"

View File

@ -0,0 +1,135 @@
"""
List of optional components.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
__all__ = []
def public(f):
__all__.append(f.__name__)
return f
OPTIONS = {
"stable": {"help": "stable ABI stub"},
"pip": {"help": "pip"},
"pip-user": {"help": "pip.ini file for default --user"},
"distutils": {"help": "distutils"},
"tcltk": {"help": "Tcl, Tk and tkinter"},
"idle": {"help": "Idle"},
"tests": {"help": "test suite"},
"tools": {"help": "tools"},
"venv": {"help": "venv"},
"dev": {"help": "headers and libs"},
"symbols": {"help": "symbols"},
"bdist-wininst": {"help": "bdist_wininst support"},
"underpth": {"help": "a python._pth file", "not-in-all": True},
"launchers": {"help": "specific launchers"},
"appxmanifest": {"help": "an appxmanifest"},
"props": {"help": "a python.props file"},
"nuspec": {"help": "a python.nuspec file"},
"chm": {"help": "the CHM documentation"},
"html-doc": {"help": "the HTML documentation"},
}
PRESETS = {
"appx": {
"help": "APPX package",
"options": [
"stable",
"pip",
"pip-user",
"distutils",
"tcltk",
"idle",
"venv",
"dev",
"launchers",
"appxmanifest",
# XXX: Disabled for now "precompile",
],
},
"nuget": {
"help": "nuget package",
"options": [
"dev",
"tools",
"pip",
"stable",
"distutils",
"venv",
"props",
"nuspec",
],
},
"iot": {"help": "Windows IoT Core", "options": ["stable", "pip"]},
"default": {
"help": "development kit package",
"options": [
"stable",
"pip",
"distutils",
"tcltk",
"idle",
"tests",
"tools",
"venv",
"dev",
"symbols",
"bdist-wininst",
"chm",
],
},
"embed": {
"help": "embeddable package",
"options": ["stable", "zip-lib", "flat-dlls", "underpth", "precompile"],
},
}
@public
def get_argparse_options():
for opt, info in OPTIONS.items():
help = "When specified, includes {}".format(info["help"])
if info.get("not-in-all"):
help = "{}. Not affected by --include-all".format(help)
yield "--include-{}".format(opt), help
for opt, info in PRESETS.items():
help = "When specified, includes default options for {}".format(info["help"])
yield "--preset-{}".format(opt), help
def ns_get(ns, key, default=False):
return getattr(ns, key.replace("-", "_"), default)
def ns_set(ns, key, value=True):
k1 = key.replace("-", "_")
k2 = "include_{}".format(k1)
if hasattr(ns, k2):
setattr(ns, k2, value)
elif hasattr(ns, k1):
setattr(ns, k1, value)
else:
raise AttributeError("no argument named '{}'".format(k1))
@public
def update_presets(ns):
for preset, info in PRESETS.items():
if ns_get(ns, "preset-{}".format(preset)):
for opt in info["options"]:
ns_set(ns, opt)
if ns.include_all:
for opt in OPTIONS:
if OPTIONS[opt].get("not-in-all"):
continue
ns_set(ns, opt)

View File

@ -0,0 +1,94 @@
"""
Extraction and file list generation for pip.
"""
__author__ = "Steve Dower <steve.dower@python.org>"
__version__ = "3.8"
import os
import shutil
import subprocess
import sys
from .filesets import *
__all__ = ["extract_pip_files", "get_pip_layout"]
def get_pip_dir(ns):
if ns.copy:
if ns.zip_lib:
return ns.copy / "packages"
return ns.copy / "Lib" / "site-packages"
else:
return ns.temp / "packages"
def get_pip_layout(ns):
pip_dir = get_pip_dir(ns)
if not pip_dir.is_dir():
log_warning("Failed to find {} - pip will not be included", pip_dir)
else:
pkg_root = "packages/{}" if ns.zip_lib else "Lib/site-packages/{}"
for dest, src in rglob(pip_dir, "**/*"):
yield pkg_root.format(dest), src
if ns.include_pip_user:
content = "\n".join(
"[{}]\nuser=yes".format(n)
for n in ["install", "uninstall", "freeze", "list"]
)
yield "pip.ini", ("pip.ini", content.encode())
def extract_pip_files(ns):
dest = get_pip_dir(ns)
try:
dest.mkdir(parents=True, exist_ok=False)
except IOError:
return
src = ns.source / "Lib" / "ensurepip" / "_bundled"
ns.temp.mkdir(parents=True, exist_ok=True)
wheels = [shutil.copy(whl, ns.temp) for whl in src.glob("*.whl")]
search_path = os.pathsep.join(wheels)
if os.environ.get("PYTHONPATH"):
search_path += ";" + os.environ["PYTHONPATH"]
env = os.environ.copy()
env["PYTHONPATH"] = search_path
output = subprocess.check_output(
[
sys.executable,
"-m",
"pip",
"--no-color",
"install",
"pip",
"setuptools",
"--upgrade",
"--target",
str(dest),
"--no-index",
"--no-compile",
"--no-cache-dir",
"-f",
str(src),
"--only-binary",
":all:",
],
env=env,
)
try:
shutil.rmtree(dest / "bin")
except OSError:
pass
for file in wheels:
try:
os.remove(file)
except OSError:
pass

View File

@ -0,0 +1,99 @@
"""
Provides .props file.
"""
import os
from .constants import *
__all__ = ["get_props_layout"]
PYTHON_PROPS_NAME = "python.props"
PROPS_DATA = {
"PYTHON_TAG": VER_DOT,
"PYTHON_VERSION": os.getenv("PYTHON_NUSPEC_VERSION"),
"PYTHON_PLATFORM": os.getenv("PYTHON_PROPS_PLATFORM"),
"PYTHON_TARGET": "",
}
if not PROPS_DATA["PYTHON_VERSION"]:
PROPS_DATA["PYTHON_VERSION"] = "{}.{}{}{}".format(
VER_DOT, VER_MICRO, "-" if VER_SUFFIX else "", VER_SUFFIX
)
PROPS_DATA["PYTHON_TARGET"] = "_GetPythonRuntimeFilesDependsOn{}{}_{}".format(
VER_MAJOR, VER_MINOR, PROPS_DATA["PYTHON_PLATFORM"]
)
PROPS_TEMPLATE = r"""<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(Platform) == '{PYTHON_PLATFORM}'">
<PythonHome Condition="$(PythonHome) == ''">$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)\..\..\tools"))</PythonHome>
<PythonInclude>$(PythonHome)\include</PythonInclude>
<PythonLibs>$(PythonHome)\libs</PythonLibs>
<PythonTag>{PYTHON_TAG}</PythonTag>
<PythonVersion>{PYTHON_VERSION}</PythonVersion>
<IncludePythonExe Condition="$(IncludePythonExe) == ''">true</IncludePythonExe>
<IncludeDistutils Condition="$(IncludeDistutils) == ''">false</IncludeDistutils>
<IncludeLib2To3 Condition="$(IncludeLib2To3) == ''">false</IncludeLib2To3>
<IncludeVEnv Condition="$(IncludeVEnv) == ''">false</IncludeVEnv>
<GetPythonRuntimeFilesDependsOn>{PYTHON_TARGET};$(GetPythonRuntimeFilesDependsOn)</GetPythonRuntimeFilesDependsOn>
</PropertyGroup>
<ItemDefinitionGroup Condition="$(Platform) == '{PYTHON_PLATFORM}'">
<ClCompile>
<AdditionalIncludeDirectories>$(PythonInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(PythonLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Target Name="GetPythonRuntimeFiles" Returns="@(PythonRuntime)" DependsOnTargets="$(GetPythonRuntimeFilesDependsOn)" />
<Target Name="{PYTHON_TARGET}" Returns="@(PythonRuntime)">
<ItemGroup>
<_PythonRuntimeExe Include="$(PythonHome)\python*.dll" />
<_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" />
<_PythonRuntimeExe>
<Link>%(Filename)%(Extension)</Link>
</_PythonRuntimeExe>
<_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.pyd" />
<_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.dll" />
<_PythonRuntimeDlls>
<Link>DLLs\%(Filename)%(Extension)</Link>
</_PythonRuntimeDlls>
<_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\distutils\**\*" Condition="$(IncludeDistutils) != 'true'" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" />
<_PythonRuntimeLib>
<Link>Lib\%(RecursiveDir)%(Filename)%(Extension)</Link>
</_PythonRuntimeLib>
<PythonRuntime Include="@(_PythonRuntimeExe);@(_PythonRuntimeDlls);@(_PythonRuntimeLib)" />
</ItemGroup>
<Message Importance="low" Text="Collected Python runtime from $(PythonHome):%0D%0A@(PythonRuntime->' %(Link)','%0D%0A')" />
</Target>
</Project>
"""
def get_props_layout(ns):
if ns.include_all or ns.include_props:
# TODO: Filter contents of props file according to included/excluded items
d = dict(PROPS_DATA)
if not d.get("PYTHON_PLATFORM"):
d["PYTHON_PLATFORM"] = {
"win32": "Win32",
"amd64": "X64",
"arm32": "ARM",
"arm64": "ARM64",
}[ns.arch]
props = PROPS_TEMPLATE.format_map(d)
yield "python.props", ("python.props", props.encode("utf-8"))

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(Platform) == '$$PYTHON_PLATFORM$$'">
<PythonHome>$(MSBuildThisFileDirectory)\..\..\tools</PythonHome>
<PythonInclude>$(PythonHome)\include</PythonInclude>
<PythonLibs>$(PythonHome)\libs</PythonLibs>
<PythonTag>$$PYTHON_TAG$$</PythonTag>
<PythonVersion>$$PYTHON_VERSION$$</PythonVersion>
<IncludePythonExe Condition="$(IncludePythonExe) == ''">true</IncludePythonExe>
<IncludeDistutils Condition="$(IncludeDistutils) == ''">false</IncludeDistutils>
<IncludeLib2To3 Condition="$(IncludeLib2To3) == ''">false</IncludeLib2To3>
<IncludeVEnv Condition="$(IncludeVEnv) == ''">false</IncludeVEnv>
<GetPythonRuntimeFilesDependsOn>$$PYTHON_TARGET$$;$(GetPythonRuntimeFilesDependsOn)</GetPythonRuntimeFilesDependsOn>
</PropertyGroup>
<ItemDefinitionGroup Condition="$(Platform) == '$$PYTHON_PLATFORM$$'">
<ClCompile>
<AdditionalIncludeDirectories>$(PythonInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(PythonLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Target Name="GetPythonRuntimeFiles" Returns="@(PythonRuntime)" DependsOnTargets="$(GetPythonRuntimeFilesDependsOn)" />
<Target Name="$$PYTHON_TARGET$$" Returns="@(PythonRuntime)">
<ItemGroup>
<_PythonRuntimeExe Include="$(PythonHome)\python*.dll" />
<_PythonRuntimeExe Include="$(PythonHome)\vcruntime140.dll" />
<_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" />
<_PythonRuntimeExe>
<Link>%(Filename)%(Extension)</Link>
</_PythonRuntimeExe>
<_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.pyd" />
<_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.dll" />
<_PythonRuntimeDlls>
<Link>DLLs\%(Filename)%(Extension)</Link>
</_PythonRuntimeDlls>
<_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\distutils\**\*" Condition="$(IncludeDistutils) != 'true'" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" />
<_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" />
<_PythonRuntimeLib>
<Link>Lib\%(RecursiveDir)%(Filename)%(Extension)</Link>
</_PythonRuntimeLib>
<PythonRuntime Include="@(_PythonRuntimeExe);@(_PythonRuntimeDlls);@(_PythonRuntimeLib)" />
</ItemGroup>
<Message Importance="low" Text="Collected Python runtime from $(PythonHome):%0D%0A@(PythonRuntime->' %(Link)','%0D%0A')" />
</Target>
</Project>

View File

@ -0,0 +1,638 @@
/*********************************************************
msvcrtmodule.c
A Python interface to the Microsoft Visual C Runtime
Library, providing access to those non-portable, but
still useful routines.
Only ever compiled with an MS compiler, so no attempt
has been made to avoid MS language extensions, etc...
This may only work on NT or 95...
Author: Mark Hammond and Guido van Rossum.
Maintenance: Guido van Rossum.
***********************************************************/
#include "Python.h"
#include "malloc.h"
#include <io.h>
#include <conio.h>
#include <sys/locking.h>
#include <crtdbg.h>
#include <windows.h>
#ifdef _MSC_VER
#if _MSC_VER >= 1500 && _MSC_VER < 1600
#include <crtassem.h>
#elif _MSC_VER >= 1600
#include <crtversion.h>
#endif
#endif
/*[python input]
class HANDLE_converter(CConverter):
type = 'void *'
format_unit = '"_Py_PARSE_UINTPTR"'
class HANDLE_return_converter(CReturnConverter):
type = 'void *'
def render(self, function, data):
self.declare(data)
self.err_occurred_if(
"_return_value == NULL || _return_value == INVALID_HANDLE_VALUE",
data)
data.return_conversion.append(
'return_value = PyLong_FromVoidPtr(_return_value);\n')
class byte_char_return_converter(CReturnConverter):
type = 'int'
def render(self, function, data):
data.declarations.append('char s[1];')
data.return_value = 's[0]'
data.return_conversion.append(
'return_value = PyBytes_FromStringAndSize(s, 1);\n')
class wchar_t_return_converter(CReturnConverter):
type = 'wchar_t'
def render(self, function, data):
self.declare(data)
data.return_conversion.append(
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=d102511df3cda2eb]*/
/*[clinic input]
module msvcrt
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f31a87a783d036cd]*/
#include "clinic/msvcrtmodule.c.h"
/*[clinic input]
msvcrt.heapmin
Minimize the malloc() heap.
Force the malloc() heap to clean itself up and return unused blocks
to the operating system. On failure, this raises OSError.
[clinic start generated code]*/
static PyObject *
msvcrt_heapmin_impl(PyObject *module)
/*[clinic end generated code: output=1ba00f344782dc19 input=82e1771d21bde2d8]*/
{
if (_heapmin() != 0)
return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
/*[clinic input]
msvcrt.locking
fd: int
mode: int
nbytes: long
/
Lock part of a file based on file descriptor fd from the C runtime.
Raises OSError on failure. The locked region of the file extends from
the current file position for nbytes bytes, and may continue beyond
the end of the file. mode must be one of the LK_* constants listed
below. Multiple regions in a file may be locked at the same time, but
may not overlap. Adjacent regions are not merged; they must be unlocked
individually.
[clinic start generated code]*/
static PyObject *
msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes)
/*[clinic end generated code: output=a4a90deca9785a03 input=e97bd15fc4a04fef]*/
{
int err;
if (PySys_Audit("msvcrt.locking", "iil", fd, mode, nbytes) < 0) {
return NULL;
}
Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
err = _locking(fd, mode, nbytes);
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
if (err != 0)
return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
/*[clinic input]
msvcrt.setmode -> long
fd: int
mode as flags: int
/
Set the line-end translation mode for the file descriptor fd.
To set it to text mode, flags should be os.O_TEXT; for binary, it
should be os.O_BINARY.
Return value is the previous mode.
[clinic start generated code]*/
static long
msvcrt_setmode_impl(PyObject *module, int fd, int flags)
/*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/
{
_Py_BEGIN_SUPPRESS_IPH
flags = _setmode(fd, flags);
_Py_END_SUPPRESS_IPH
if (flags == -1)
PyErr_SetFromErrno(PyExc_OSError);
return flags;
}
/*[clinic input]
msvcrt.open_osfhandle -> long
handle: HANDLE
flags: int
/
Create a C runtime file descriptor from the file handle handle.
The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,
and os.O_TEXT. The returned file descriptor may be used as a parameter
to os.fdopen() to create a file object.
[clinic start generated code]*/
static long
msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags)
/*[clinic end generated code: output=b2fb97c4b515e4e6 input=d5db190a307cf4bb]*/
{
int fd;
if (PySys_Audit("msvcrt.open_osfhandle", "Ki", handle, flags) < 0) {
return -1;
}
_Py_BEGIN_SUPPRESS_IPH
fd = _open_osfhandle((intptr_t)handle, flags);
_Py_END_SUPPRESS_IPH
if (fd == -1)
PyErr_SetFromErrno(PyExc_OSError);
return fd;
}
/*[clinic input]
msvcrt.get_osfhandle -> HANDLE
fd: int
/
Return the file handle for the file descriptor fd.
Raises OSError if fd is not recognized.
[clinic start generated code]*/
static void *
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
/*[clinic end generated code: output=aca01dfe24637374 input=5fcfde9b17136aa2]*/
{
intptr_t handle = -1;
if (PySys_Audit("msvcrt.get_osfhandle", "(i)", fd) < 0) {
return NULL;
}
_Py_BEGIN_SUPPRESS_IPH
handle = _get_osfhandle(fd);
_Py_END_SUPPRESS_IPH
if (handle == -1)
PyErr_SetFromErrno(PyExc_OSError);
return (HANDLE)handle;
}
/* Console I/O */
/*[clinic input]
msvcrt.kbhit -> long
Return true if a keypress is waiting to be read.
[clinic start generated code]*/
static long
msvcrt_kbhit_impl(PyObject *module)
/*[clinic end generated code: output=940dfce6587c1890 input=e70d678a5c2f6acc]*/
{
return _kbhit();
}
/*[clinic input]
msvcrt.getch -> byte_char
Read a keypress and return the resulting character as a byte string.
Nothing is echoed to the console. This call will block if a keypress is
not already available, but will not wait for Enter to be pressed. If the
pressed key was a special function key, this will return '\000' or
'\xe0'; the next call will return the keycode. The Control-C keypress
cannot be read with this function.
[clinic start generated code]*/
static int
msvcrt_getch_impl(PyObject *module)
/*[clinic end generated code: output=a4e51f0565064a7d input=37a40cf0ed0d1153]*/
{
int ch;
Py_BEGIN_ALLOW_THREADS
ch = _getch();
Py_END_ALLOW_THREADS
return ch;
}
/*[clinic input]
msvcrt.getwch -> wchar_t
Wide char variant of getch(), returning a Unicode value.
[clinic start generated code]*/
static wchar_t
msvcrt_getwch_impl(PyObject *module)
/*[clinic end generated code: output=be9937494e22f007 input=27b3dec8ad823d7c]*/
{
wchar_t ch;
Py_BEGIN_ALLOW_THREADS
ch = _getwch();
Py_END_ALLOW_THREADS
return ch;
}
/*[clinic input]
msvcrt.getche -> byte_char
Similar to getch(), but the keypress will be echoed if possible.
[clinic start generated code]*/
static int
msvcrt_getche_impl(PyObject *module)
/*[clinic end generated code: output=d8f7db4fd2990401 input=43311ade9ed4a9c0]*/
{
int ch;
Py_BEGIN_ALLOW_THREADS
ch = _getche();
Py_END_ALLOW_THREADS
return ch;
}
/*[clinic input]
msvcrt.getwche -> wchar_t
Wide char variant of getche(), returning a Unicode value.
[clinic start generated code]*/
static wchar_t
msvcrt_getwche_impl(PyObject *module)
/*[clinic end generated code: output=d0dae5ba3829d596 input=49337d59d1a591f8]*/
{
wchar_t ch;
Py_BEGIN_ALLOW_THREADS
ch = _getwche();
Py_END_ALLOW_THREADS
return ch;
}
/*[clinic input]
msvcrt.putch
char: char
/
Print the byte string char to the console without buffering.
[clinic start generated code]*/
static PyObject *
msvcrt_putch_impl(PyObject *module, char char_value)
/*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/
{
_Py_BEGIN_SUPPRESS_IPH
_putch(char_value);
_Py_END_SUPPRESS_IPH
Py_RETURN_NONE;
}
/*[clinic input]
msvcrt.putwch
unicode_char: int(accept={str})
/
Wide char variant of putch(), accepting a Unicode value.
[clinic start generated code]*/
static PyObject *
msvcrt_putwch_impl(PyObject *module, int unicode_char)
/*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/
{
_Py_BEGIN_SUPPRESS_IPH
_putwch(unicode_char);
_Py_END_SUPPRESS_IPH
Py_RETURN_NONE;
}
/*[clinic input]
msvcrt.ungetch
char: char
/
Opposite of getch.
Cause the byte string char to be "pushed back" into the
console buffer; it will be the next character read by
getch() or getche().
[clinic start generated code]*/
static PyObject *
msvcrt_ungetch_impl(PyObject *module, char char_value)
/*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/
{
int res;
_Py_BEGIN_SUPPRESS_IPH
res = _ungetch(char_value);
_Py_END_SUPPRESS_IPH
if (res == EOF)
return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
/*[clinic input]
msvcrt.ungetwch
unicode_char: int(accept={str})
/
Wide char variant of ungetch(), accepting a Unicode value.
[clinic start generated code]*/
static PyObject *
msvcrt_ungetwch_impl(PyObject *module, int unicode_char)
/*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/
{
int res;
_Py_BEGIN_SUPPRESS_IPH
res = _ungetwch(unicode_char);
_Py_END_SUPPRESS_IPH
if (res == WEOF)
return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
#ifdef _DEBUG
/*[clinic input]
msvcrt.CrtSetReportFile -> HANDLE
type: int
file: HANDLE
/
Wrapper around _CrtSetReportFile.
Only available on Debug builds.
[clinic start generated code]*/
static void *
msvcrt_CrtSetReportFile_impl(PyObject *module, int type, void *file)
/*[clinic end generated code: output=9393e8c77088bbe9 input=290809b5f19e65b9]*/
{
HANDLE res;
_Py_BEGIN_SUPPRESS_IPH
res = _CrtSetReportFile(type, file);
_Py_END_SUPPRESS_IPH
return res;
}
/*[clinic input]
msvcrt.CrtSetReportMode -> long
type: int
mode: int
/
Wrapper around _CrtSetReportMode.
Only available on Debug builds.
[clinic start generated code]*/
static long
msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode)
/*[clinic end generated code: output=b2863761523de317 input=9319d29b4319426b]*/
{
int res;
_Py_BEGIN_SUPPRESS_IPH
res = _CrtSetReportMode(type, mode);
_Py_END_SUPPRESS_IPH
if (res == -1)
PyErr_SetFromErrno(PyExc_OSError);
return res;
}
/*[clinic input]
msvcrt.set_error_mode -> long
mode: int
/
Wrapper around _set_error_mode.
Only available on Debug builds.
[clinic start generated code]*/
static long
msvcrt_set_error_mode_impl(PyObject *module, int mode)
/*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/
{
long res;
_Py_BEGIN_SUPPRESS_IPH
res = _set_error_mode(mode);
_Py_END_SUPPRESS_IPH
return res;
}
#endif /* _DEBUG */
/*[clinic input]
msvcrt.SetErrorMode
mode: unsigned_int(bitwise=True)
/
Wrapper around SetErrorMode.
[clinic start generated code]*/
static PyObject *
msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode)
/*[clinic end generated code: output=01d529293f00da8f input=d8b167258d32d907]*/
{
unsigned int res;
_Py_BEGIN_SUPPRESS_IPH
res = SetErrorMode(mode);
_Py_END_SUPPRESS_IPH
return PyLong_FromUnsignedLong(res);
}
/*[clinic input]
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=da39a3ee5e6b4b0d]*/
/* List of functions exported by this module */
static struct PyMethodDef msvcrt_functions[] = {
MSVCRT_HEAPMIN_METHODDEF
MSVCRT_LOCKING_METHODDEF
MSVCRT_SETMODE_METHODDEF
MSVCRT_OPEN_OSFHANDLE_METHODDEF
MSVCRT_GET_OSFHANDLE_METHODDEF
MSVCRT_KBHIT_METHODDEF
MSVCRT_GETCH_METHODDEF
MSVCRT_GETCHE_METHODDEF
MSVCRT_PUTCH_METHODDEF
MSVCRT_UNGETCH_METHODDEF
MSVCRT_SETERRORMODE_METHODDEF
MSVCRT_CRTSETREPORTFILE_METHODDEF
MSVCRT_CRTSETREPORTMODE_METHODDEF
MSVCRT_SET_ERROR_MODE_METHODDEF
MSVCRT_GETWCH_METHODDEF
MSVCRT_GETWCHE_METHODDEF
MSVCRT_PUTWCH_METHODDEF
MSVCRT_UNGETWCH_METHODDEF
{NULL, NULL}
};
static struct PyModuleDef msvcrtmodule = {
PyModuleDef_HEAD_INIT,
"msvcrt",
NULL,
-1,
msvcrt_functions,
NULL,
NULL,
NULL,
NULL
};
static void
insertint(PyObject *d, char *name, int value)
{
PyObject *v = PyLong_FromLong((long) value);
if (v == NULL) {
/* Don't bother reporting this error */
PyErr_Clear();
}
else {
PyDict_SetItemString(d, name, v);
Py_DECREF(v);
}
}
static void
insertptr(PyObject *d, char *name, void *value)
{
PyObject *v = PyLong_FromVoidPtr(value);
if (v == NULL) {
/* Don't bother reporting this error */
PyErr_Clear();
}
else {
PyDict_SetItemString(d, name, v);
Py_DECREF(v);
}
}
PyMODINIT_FUNC
PyInit_msvcrt(void)
{
int st;
PyObject *d, *version;
PyObject *m = PyModule_Create(&msvcrtmodule);
if (m == NULL)
return NULL;
d = PyModule_GetDict(m);
/* constants for the locking() function's mode argument */
insertint(d, "LK_LOCK", _LK_LOCK);
insertint(d, "LK_NBLCK", _LK_NBLCK);
insertint(d, "LK_NBRLCK", _LK_NBRLCK);
insertint(d, "LK_RLCK", _LK_RLCK);
insertint(d, "LK_UNLCK", _LK_UNLCK);
insertint(d, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS);
insertint(d, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT);
insertint(d, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX);
insertint(d, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX);
#ifdef _DEBUG
insertint(d, "CRT_WARN", _CRT_WARN);
insertint(d, "CRT_ERROR", _CRT_ERROR);
insertint(d, "CRT_ASSERT", _CRT_ASSERT);
insertint(d, "CRTDBG_MODE_DEBUG", _CRTDBG_MODE_DEBUG);
insertint(d, "CRTDBG_MODE_FILE", _CRTDBG_MODE_FILE);
insertint(d, "CRTDBG_MODE_WNDW", _CRTDBG_MODE_WNDW);
insertint(d, "CRTDBG_REPORT_MODE", _CRTDBG_REPORT_MODE);
insertptr(d, "CRTDBG_FILE_STDERR", _CRTDBG_FILE_STDERR);
insertptr(d, "CRTDBG_FILE_STDOUT", _CRTDBG_FILE_STDOUT);
insertptr(d, "CRTDBG_REPORT_FILE", _CRTDBG_REPORT_FILE);
#endif
/* constants for the crt versions */
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
_VC_ASSEMBLY_PUBLICKEYTOKEN);
if (st < 0) return NULL;
#endif
#ifdef _CRT_ASSEMBLY_VERSION
st = PyModule_AddStringConstant(m, "CRT_ASSEMBLY_VERSION",
_CRT_ASSEMBLY_VERSION);
if (st < 0) return NULL;
#endif
#ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX
st = PyModule_AddStringConstant(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX",
__LIBRARIES_ASSEMBLY_NAME_PREFIX);
if (st < 0) return NULL;
#endif
/* constants for the 2010 crt versions */
#if defined(_VC_CRT_MAJOR_VERSION) && defined (_VC_CRT_MINOR_VERSION) && defined(_VC_CRT_BUILD_VERSION) && defined(_VC_CRT_RBUILD_VERSION)
version = PyUnicode_FromFormat("%d.%d.%d.%d", _VC_CRT_MAJOR_VERSION,
_VC_CRT_MINOR_VERSION,
_VC_CRT_BUILD_VERSION,
_VC_CRT_RBUILD_VERSION);
st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
if (st < 0) return NULL;
#endif
/* make compiler warning quiet if st is unused */
(void)st;
return m;
}

View File

@ -0,0 +1,687 @@
#ifndef Py_CONFIG_H
#define Py_CONFIG_H
/* pyconfig.h. NOT Generated automatically by configure.
This is a manually maintained version used for the Watcom,
Borland and Microsoft Visual C++ compilers. It is a
standard part of the Python distribution.
WINDOWS DEFINES:
The code specific to Windows should be wrapped around one of
the following #defines
MS_WIN64 - Code specific to the MS Win64 API
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
MS_WINDOWS - Code specific to Windows, but all versions.
Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
Also note that neither "_M_IX86" or "_MSC_VER" should be used for
any purpose other than "Windows Intel x86 specific" and "Microsoft
compiler specific". Therefore, these should be very rare.
NOTE: The following symbols are deprecated:
NT, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT
MS_CORE_DLL.
WIN32 is still required for the locale module.
*/
/* Deprecated USE_DL_EXPORT macro - please use Py_BUILD_CORE */
#ifdef USE_DL_EXPORT
# define Py_BUILD_CORE
#endif /* USE_DL_EXPORT */
/* Visual Studio 2005 introduces deprecation warnings for
"insecure" and POSIX functions. The insecure functions should
be replaced by *_s versions (according to Microsoft); the
POSIX functions by _* versions (which, according to Microsoft,
would be ISO C conforming). Neither renaming is feasible, so
we just silence the warnings. */
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
#define HAVE_IO_H
#define HAVE_SYS_UTIME_H
#define HAVE_TEMPNAM
#define HAVE_TMPFILE
#define HAVE_TMPNAM
#define HAVE_CLOCK
#define HAVE_STRERROR
#include <io.h>
#define HAVE_HYPOT
#define HAVE_STRFTIME
#define DONT_HAVE_SIG_ALARM
#define DONT_HAVE_SIG_PAUSE
#define LONG_BIT 32
#define WORD_BIT 32
#define MS_WIN32 /* only support win32 and greater. */
#define MS_WINDOWS
#ifndef PYTHONPATH
# define PYTHONPATH L".\\DLLs;.\\lib"
#endif
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
/* Compiler specific defines */
/* ------------------------------------------------------------------------*/
/* Microsoft C defines _MSC_VER */
#ifdef _MSC_VER
/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
* This is horridly tricky, because the stringization operator only works
* on macro arguments, and doesn't evaluate macros passed *as* arguments.
* Attempts simpler than the following appear doomed to produce "_MSC_VER"
* literally in the string.
*/
#define _Py_PASTE_VERSION(SUFFIX) \
("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]")
/* e.g., this produces, after compile-time string catenation,
* ("[MSC v.1200 32 bit (Intel)]")
*
* _Py_STRINGIZE(_MSC_VER) expands to
* _Py_STRINGIZE1((_MSC_VER)) expands to
* _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
* it's scanned again for macros and so further expands to (under MSVC 6)
* _Py_STRINGIZE2(1200) which then expands to
* "1200"
*/
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
#define _Py_STRINGIZE2(X) #X
/* MSVC defines _WINxx to differentiate the windows platform types
Note that for compatibility reasons _WIN32 is defined on Win32
*and* on Win64. For the same reasons, in Python, MS_WIN32 is
defined on Win32 *and* Win64. Win32 only code must therefore be
guarded as follows:
#if defined(MS_WIN32) && !defined(MS_WIN64)
*/
#ifdef _WIN64
#define MS_WIN64
#endif
/* set the COMPILER */
#ifdef MS_WIN64
#if defined(_M_X64) || defined(_M_AMD64)
#if defined(__INTEL_COMPILER)
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
#endif /* __INTEL_COMPILER */
#define PYD_PLATFORM_TAG "win_amd64"
#elif defined(_M_ARM64)
#define COMPILER _Py_PASTE_VERSION("64 bit (ARM64)")
#define PYD_PLATFORM_TAG "win_arm64"
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
#endif
#endif /* MS_WIN64 */
/* set the version macros for the windows headers */
/* Python 3.9+ requires Windows 8 or greater */
#define Py_WINVER 0x0602 /* _WIN32_WINNT_WIN8 */
#define Py_NTDDI NTDDI_WIN8
/* We only set these values when building Python - we don't want to force
these values on extensions, as that will affect the prototypes and
structures exposed in the Windows headers. Even when building Python, we
allow a single source file to override this - they may need access to
structures etc so it can optionally use new Windows features if it
determines at runtime they are available.
*/
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) || defined(Py_BUILD_CORE_MODULE)
#ifndef NTDDI_VERSION
#define NTDDI_VERSION Py_NTDDI
#endif
#ifndef WINVER
#define WINVER Py_WINVER
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT Py_WINVER
#endif
#endif
/* _W64 is not defined for VC6 or eVC4 */
#ifndef _W64
#define _W64
#endif
/* Define like size_t, omitting the "unsigned" */
#ifdef MS_WIN64
typedef __int64 ssize_t;
#else
typedef _W64 int ssize_t;
#endif
#define HAVE_SSIZE_T 1
#if defined(MS_WIN32) && !defined(MS_WIN64)
#if defined(_M_IX86)
#if defined(__INTEL_COMPILER)
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
#else
#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
#endif /* __INTEL_COMPILER */
#define PYD_PLATFORM_TAG "win32"
#elif defined(_M_ARM)
#define COMPILER _Py_PASTE_VERSION("32 bit (ARM)")
#define PYD_PLATFORM_TAG "win_arm32"
#else
#define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
#endif
#endif /* MS_WIN32 && !MS_WIN64 */
typedef int pid_t;
#include <float.h>
#define Py_IS_NAN _isnan
#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
#define Py_IS_FINITE(X) _finite(X)
/* define some ANSI types that are not defined in earlier Win headers */
#if _MSC_VER >= 1200
/* This file only exists in VC 6.0 or higher */
#include <basetsd.h>
#endif
#endif /* _MSC_VER */
/* ------------------------------------------------------------------------*/
/* egcs/gnu-win32 defines __GNUC__ and _WIN32 */
#if defined(__GNUC__) && defined(_WIN32)
/* XXX These defines are likely incomplete, but should be easy to fix.
They should be complete enough to build extension modules. */
/* Suggested by Rene Liebscher <R.Liebscher@gmx.de> to avoid a GCC 2.91.*
bug that requires structure imports. More recent versions of the
compiler don't exhibit this bug.
*/
#if (__GNUC__==2) && (__GNUC_MINOR__<=91)
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
#endif
#define COMPILER "[gcc]"
#define PY_LONG_LONG long long
#define PY_LLONG_MIN LLONG_MIN
#define PY_LLONG_MAX LLONG_MAX
#define PY_ULLONG_MAX ULLONG_MAX
#endif /* GNUC */
/* ------------------------------------------------------------------------*/
/* lcc-win32 defines __LCC__ */
#if defined(__LCC__)
/* XXX These defines are likely incomplete, but should be easy to fix.
They should be complete enough to build extension modules. */
#define COMPILER "[lcc-win32]"
typedef int pid_t;
/* __declspec() is supported here too - do nothing to get the defaults */
#endif /* LCC */
/* ------------------------------------------------------------------------*/
/* End of compilers - finish up */
#ifndef NO_STDIO_H
# include <stdio.h>
#endif
/* 64 bit ints are usually spelt __int64 unless compiler has overridden */
#ifndef PY_LONG_LONG
# define PY_LONG_LONG __int64
# define PY_LLONG_MAX _I64_MAX
# define PY_LLONG_MIN _I64_MIN
# define PY_ULLONG_MAX _UI64_MAX
#endif
/* For Windows the Python core is in a DLL by default. Test
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
# define MS_COREDLL /* deprecated old symbol */
#endif /* !MS_NO_COREDLL && ... */
/* All windows compilers that use this header support __declspec */
#define HAVE_DECLSPEC_DLL
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
# if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
/* not building the core - must be an ext */
# if defined(_MSC_VER)
/* So MSVC users need not specify the .lib
file in their Makefile (other compilers are
generally taken care of by distutils.) */
# if defined(_DEBUG)
# pragma comment(lib,"python39_d.lib")
# elif defined(Py_LIMITED_API)
# pragma comment(lib,"python3.lib")
# else
# pragma comment(lib,"python39.lib")
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */
#if defined(MS_WIN64)
/* maintain "win32" sys.platform for backward compatibility of Python code,
the Win64 API should be close enough to the Win32 API to make this
preferable */
# define PLATFORM "win32"
# define SIZEOF_VOID_P 8
# define SIZEOF_TIME_T 8
# define SIZEOF_OFF_T 4
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 8
# define SIZEOF_SIZE_T 8
/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff
sizeof(off_t) > sizeof(long), and sizeof(long long) >= sizeof(off_t).
On Win64 the second condition is not true, but if fpos_t replaces off_t
then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
should define this. */
# define HAVE_LARGEFILE_SUPPORT
#elif defined(MS_WIN32)
# define PLATFORM "win32"
# define HAVE_LARGEFILE_SUPPORT
# define SIZEOF_VOID_P 4
# define SIZEOF_OFF_T 4
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 4
# define SIZEOF_SIZE_T 4
/* MS VS2005 changes time_t to a 64-bit type on all platforms */
# if defined(_MSC_VER) && _MSC_VER >= 1400
# define SIZEOF_TIME_T 8
# else
# define SIZEOF_TIME_T 4
# endif
#endif
#ifdef _DEBUG
# define Py_DEBUG
#endif
#ifdef MS_WIN32
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_DOUBLE 8
#define SIZEOF_FLOAT 4
/* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version number of 1200.
Microsoft eMbedded Visual C++ 4.0 has a version number of 1201 and doesn't
define these.
If some compiler does not provide them, modify the #if appropriately. */
#if defined(_MSC_VER)
#if _MSC_VER > 1300
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#else
/* VC6, VS 2002 and eVC4 don't support the C99 LL suffix for 64-bit integer literals */
#define Py_LL(x) x##I64
#endif /* _MSC_VER > 1300 */
#endif /* _MSC_VER */
#endif
/* define signed and unsigned exact-width 32-bit and 64-bit types, used in the
implementation of Python integers. */
#define PY_UINT32_T uint32_t
#define PY_UINT64_T uint64_t
#define PY_INT32_T int32_t
#define PY_INT64_T int64_t
/* Fairly standard from here! */
/* Define to 1 if you have the `copysign' function. */
#define HAVE_COPYSIGN 1
/* Define to 1 if you have the `round' function. */
#if _MSC_VER >= 1800
#define HAVE_ROUND 1
#endif
/* Define to 1 if you have the `isinf' macro. */
#define HAVE_DECL_ISINF 1
/* Define to 1 if you have the `isnan' function. */
#define HAVE_DECL_ISNAN 1
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* #undef _ALL_SOURCE */
#endif
/* Define to empty if the keyword does not work. */
/* #define const */
/* Define to 1 if you have the <conio.h> header file. */
#define HAVE_CONIO_H 1
/* Define to 1 if you have the <direct.h> header file. */
#define HAVE_DIRECT_H 1
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
*/
#define HAVE_DECL_TZNAME 1
/* Define if you have dirent.h. */
/* #define DIRENT 1 */
/* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */
/* #undef GETGROUPS_T */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define if your struct tm has tm_zone. */
/* #undef HAVE_TM_ZONE */
/* Define if you don't have tm_zone but do have the external array
tzname. */
#define HAVE_TZNAME
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef mode_t */
/* Define if you don't have dirent.h, but have ndir.h. */
/* #undef NDIR */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define if the system does not provide POSIX.1 features except
with this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define if you need to in order for stat and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you don't have dirent.h, but have sys/dir.h. */
/* #undef SYSDIR */
/* Define if you don't have dirent.h, but have sys/ndir.h. */
/* #undef SYSNDIR */
/* Define if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define if your <sys/time.h> declares struct tm. */
/* #define TM_IN_SYS_TIME 1 */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define if the closedir function returns void instead of int. */
/* #undef VOID_CLOSEDIR */
/* Define if getpgrp() must be called as getpgrp(0)
and (consequently) setpgrp() as setpgrp(0, 0). */
/* #undef GETPGRP_HAVE_ARGS */
/* Define this if your time.h defines altzone */
/* #define HAVE_ALTZONE */
/* Define if you have the putenv function. */
#define HAVE_PUTENV
/* Define if your compiler supports function prototypes */
#define HAVE_PROTOTYPES
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
(which you can't on SCO ODT 3.0). */
/* #undef SYS_SELECT_WITH_SYS_TIME */
/* Define if you want build the _decimal module using a coroutine-local rather
than a thread-local context */
#define WITH_DECIMAL_CONTEXTVAR 1
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
/* Define if you want to compile in rudimentary thread support */
/* #undef WITH_THREAD */
/* Define if you want to use the GNU readline library */
/* #define WITH_READLINE 1 */
/* Use Python's own small-block memory-allocator. */
#define WITH_PYMALLOC 1
/* Define if you have clock. */
/* #define HAVE_CLOCK */
/* Define when any dynamic module loading is enabled */
#define HAVE_DYNAMIC_LOADING
/* Define if you have ftime. */
#define HAVE_FTIME
/* Define if you have getpeername. */
#define HAVE_GETPEERNAME
/* Define if you have getpgrp. */
/* #undef HAVE_GETPGRP */
/* Define if you have getpid. */
#define HAVE_GETPID
/* Define if you have gettimeofday. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define if you have getwd. */
/* #undef HAVE_GETWD */
/* Define if you have lstat. */
/* #undef HAVE_LSTAT */
/* Define if you have the mktime function. */
#define HAVE_MKTIME
/* Define if you have nice. */
/* #undef HAVE_NICE */
/* Define if you have readlink. */
/* #undef HAVE_READLINK */
/* Define if you have setpgid. */
/* #undef HAVE_SETPGID */
/* Define if you have setpgrp. */
/* #undef HAVE_SETPGRP */
/* Define if you have setsid. */
/* #undef HAVE_SETSID */
/* Define if you have setvbuf. */
#define HAVE_SETVBUF
/* Define if you have siginterrupt. */
/* #undef HAVE_SIGINTERRUPT */
/* Define if you have symlink. */
/* #undef HAVE_SYMLINK */
/* Define if you have tcgetpgrp. */
/* #undef HAVE_TCGETPGRP */
/* Define if you have tcsetpgrp. */
/* #undef HAVE_TCSETPGRP */
/* Define if you have times. */
/* #undef HAVE_TIMES */
/* Define if you have uname. */
/* #undef HAVE_UNAME */
/* Define if you have waitpid. */
/* #undef HAVE_WAITPID */
/* Define to 1 if you have the `wcsftime' function. */
#if defined(_MSC_VER) && _MSC_VER >= 1310
#define HAVE_WCSFTIME 1
#endif
/* Define to 1 if you have the `wcscoll' function. */
#define HAVE_WCSCOLL 1
/* Define to 1 if you have the `wcsxfrm' function. */
#define HAVE_WCSXFRM 1
/* Define if the zlib library has inflateCopy */
#define HAVE_ZLIB_COPY 1
/* Define if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <process.h> header file. */
#define HAVE_PROCESS_H 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define if you have the <stdarg.h> prototypes. */
#define HAVE_STDARG_PROTOTYPES
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define if you have the <sys/param.h> header file. */
/* #define HAVE_SYS_PARAM_H 1 */
/* Define if you have the <sys/select.h> header file. */
/* #define HAVE_SYS_SELECT_H 1 */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define if you have the <sys/time.h> header file. */
/* #define HAVE_SYS_TIME_H 1 */
/* Define if you have the <sys/times.h> header file. */
/* #define HAVE_SYS_TIMES_H 1 */
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <sys/un.h> header file. */
/* #define HAVE_SYS_UN_H 1 */
/* Define if you have the <sys/utime.h> header file. */
/* #define HAVE_SYS_UTIME_H 1 */
/* Define if you have the <sys/utsname.h> header file. */
/* #define HAVE_SYS_UTSNAME_H 1 */
/* Define if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
/* Define if you have the <utime.h> header file. */
/* #define HAVE_UTIME_H 1 */
/* Define if the compiler provides a wchar.h header file. */
#define HAVE_WCHAR_H 1
/* The size of `wchar_t', as computed by sizeof. */
#define SIZEOF_WCHAR_T 2
/* The size of `_Bool', as computed by sizeof. */
#define SIZEOF__BOOL 1
/* The size of `pid_t', as computed by sizeof. */
#define SIZEOF_PID_T SIZEOF_INT
/* Define if you have the dl library (-ldl). */
/* #undef HAVE_LIBDL */
/* Define if you have the mpc library (-lmpc). */
/* #undef HAVE_LIBMPC */
/* Define if you have the nsl library (-lnsl). */
#define HAVE_LIBNSL 1
/* Define if you have the seq library (-lseq). */
/* #undef HAVE_LIBSEQ */
/* Define if you have the socket library (-lsocket). */
#define HAVE_LIBSOCKET 1
/* Define if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */
/* Define if you have the termcap library (-ltermcap). */
/* #undef HAVE_LIBTERMCAP */
/* Define if you have the termlib library (-ltermlib). */
/* #undef HAVE_LIBTERMLIB */
/* Define if you have the thread library (-lthread). */
/* #undef HAVE_LIBTHREAD */
/* WinSock does not use a bitmask in select, and uses
socket handles greater than FD_SETSIZE */
#define Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the
least significant byte first */
#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1
/* Define to 1 if you have the `erf' function. */
#define HAVE_ERF 1
/* Define to 1 if you have the `erfc' function. */
#define HAVE_ERFC 1
/* Define if you have the 'inet_pton' function. */
#define HAVE_INET_PTON 1
/* framework name */
#define _PYTHONFRAMEWORK ""
/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1
#define PLATLIBDIR "lib"
#endif /* !Py_CONFIG_H */

View File

@ -0,0 +1,60 @@
#include <windows.h>
#include "python_ver_rc.h"
// Include the manifest file that indicates we support all
// current versions of Windows.
#include <winuser.h>
1 RT_MANIFEST "python.manifest"
#if defined(PY_ICON)
1 ICON DISCARDABLE "icons\python.ico"
#elif defined(PYW_ICON)
1 ICON DISCARDABLE "icons\pythonw.ico"
#else
1 ICON DISCARDABLE "icons\launcher.ico"
2 ICON DISCARDABLE "icons\py.ico"
3 ICON DISCARDABLE "icons\pyc.ico"
4 ICON DISCARDABLE "icons\pyd.ico"
5 ICON DISCARDABLE "icons\python.ico"
6 ICON DISCARDABLE "icons\pythonw.ico"
7 ICON DISCARDABLE "icons\setup.ico"
#endif
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION PYVERSION64
PRODUCTVERSION PYVERSION64
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", PYTHON_COMPANY "\0"
VALUE "FileDescription", "Python\0"
VALUE "FileVersion", PYTHON_VERSION
VALUE "InternalName", "Python Launcher\0"
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
VALUE "OriginalFilename", "py" PYTHON_DEBUG_EXT ".exe\0"
VALUE "ProductName", "Python\0"
VALUE "ProductVersion", PYTHON_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

View File

@ -0,0 +1,610 @@
// Support back to Vista
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#include <sdkddkver.h>
// Use WRL to define a classic COM class
#define __WRL_CLASSIC_COM__
#include <wrl.h>
#include <windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <olectl.h>
#include <strsafe.h>
#include "pyshellext_h.h"
#define DDWM_UPDATEWINDOW (WM_USER+3)
static HINSTANCE hModule;
static CLIPFORMAT cfDropDescription;
static CLIPFORMAT cfDragWindow;
static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\{BEA218D2-6950-497B-9434-61683EC065FE}";
static const LPCWSTR DRAG_MESSAGE = L"Open with %1";
using namespace Microsoft::WRL;
HRESULT FilenameListCchLengthA(LPCSTR pszSource, size_t cchMax, size_t *pcchLength, size_t *pcchCount) {
HRESULT hr = S_OK;
size_t count = 0;
size_t length = 0;
while (pszSource && pszSource[0]) {
size_t oneLength;
hr = StringCchLengthA(pszSource, cchMax - length, &oneLength);
if (FAILED(hr)) {
return hr;
}
count += 1;
length += oneLength + (strchr(pszSource, ' ') ? 3 : 1);
pszSource = &pszSource[oneLength + 1];
}
*pcchCount = count;
*pcchLength = length;
return hr;
}
HRESULT FilenameListCchLengthW(LPCWSTR pszSource, size_t cchMax, size_t *pcchLength, size_t *pcchCount) {
HRESULT hr = S_OK;
size_t count = 0;
size_t length = 0;
while (pszSource && pszSource[0]) {
size_t oneLength;
hr = StringCchLengthW(pszSource, cchMax - length, &oneLength);
if (FAILED(hr)) {
return hr;
}
count += 1;
length += oneLength + (wcschr(pszSource, ' ') ? 3 : 1);
pszSource = &pszSource[oneLength + 1];
}
*pcchCount = count;
*pcchLength = length;
return hr;
}
HRESULT FilenameListCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, LPCSTR pszSource, LPCSTR pszSeparator) {
HRESULT hr = S_OK;
size_t count = 0;
size_t length = 0;
while (pszSource[0]) {
STRSAFE_LPSTR newDest;
hr = StringCchCopyExA(pszDest, cchDest, pszSource, &newDest, &cchDest, 0);
if (FAILED(hr)) {
return hr;
}
pszSource += (newDest - pszDest) + 1;
pszDest = PathQuoteSpacesA(pszDest) ? newDest + 2 : newDest;
if (pszSource[0]) {
hr = StringCchCopyExA(pszDest, cchDest, pszSeparator, &newDest, &cchDest, 0);
if (FAILED(hr)) {
return hr;
}
pszDest = newDest;
}
}
return hr;
}
HRESULT FilenameListCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, LPCWSTR pszSource, LPCWSTR pszSeparator) {
HRESULT hr = S_OK;
size_t count = 0;
size_t length = 0;
while (pszSource[0]) {
STRSAFE_LPWSTR newDest;
hr = StringCchCopyExW(pszDest, cchDest, pszSource, &newDest, &cchDest, 0);
if (FAILED(hr)) {
return hr;
}
pszSource += (newDest - pszDest) + 1;
pszDest = PathQuoteSpacesW(pszDest) ? newDest + 2 : newDest;
if (pszSource[0]) {
hr = StringCchCopyExW(pszDest, cchDest, pszSeparator, &newDest, &cchDest, 0);
if (FAILED(hr)) {
return hr;
}
pszDest = newDest;
}
}
return hr;
}
class PyShellExt : public RuntimeClass<
RuntimeClassFlags<ClassicCom>,
IDropTarget,
IPersistFile
>
{
LPOLESTR target, target_dir;
DWORD target_mode;
IDataObject *data_obj;
public:
PyShellExt() : target(NULL), target_dir(NULL), target_mode(0), data_obj(NULL) {
OutputDebugString(L"PyShellExt::PyShellExt");
}
~PyShellExt() {
if (target) {
CoTaskMemFree(target);
}
if (target_dir) {
CoTaskMemFree(target_dir);
}
if (data_obj) {
data_obj->Release();
}
}
private:
HRESULT UpdateDropDescription(IDataObject *pDataObj) {
STGMEDIUM medium;
FORMATETC fmt = {
cfDropDescription,
NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL
};
auto hr = pDataObj->GetData(&fmt, &medium);
if (FAILED(hr)) {
OutputDebugString(L"PyShellExt::UpdateDropDescription - failed to get DROPDESCRIPTION format");
return hr;
}
if (!medium.hGlobal) {
OutputDebugString(L"PyShellExt::UpdateDropDescription - DROPDESCRIPTION format had NULL hGlobal");
ReleaseStgMedium(&medium);
return E_FAIL;
}
auto dd = (DROPDESCRIPTION*)GlobalLock(medium.hGlobal);
if (!dd) {
OutputDebugString(L"PyShellExt::UpdateDropDescription - failed to lock DROPDESCRIPTION hGlobal");
ReleaseStgMedium(&medium);
return E_FAIL;
}
StringCchCopy(dd->szMessage, sizeof(dd->szMessage) / sizeof(dd->szMessage[0]), DRAG_MESSAGE);
StringCchCopy(dd->szInsert, sizeof(dd->szInsert) / sizeof(dd->szInsert[0]), PathFindFileNameW(target));
dd->type = DROPIMAGE_MOVE;
GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium);
return S_OK;
}
HRESULT GetDragWindow(IDataObject *pDataObj, HWND *phWnd) {
HRESULT hr;
HWND *pMem;
STGMEDIUM medium;
FORMATETC fmt = {
cfDragWindow,
NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL
};
hr = pDataObj->GetData(&fmt, &medium);
if (FAILED(hr)) {
OutputDebugString(L"PyShellExt::GetDragWindow - failed to get DragWindow format");
return hr;
}
if (!medium.hGlobal) {
OutputDebugString(L"PyShellExt::GetDragWindow - DragWindow format had NULL hGlobal");
ReleaseStgMedium(&medium);
return E_FAIL;
}
pMem = (HWND*)GlobalLock(medium.hGlobal);
if (!pMem) {
OutputDebugString(L"PyShellExt::GetDragWindow - failed to lock DragWindow hGlobal");
ReleaseStgMedium(&medium);
return E_FAIL;
}
*phWnd = *pMem;
GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium);
return S_OK;
}
HRESULT GetArguments(IDataObject *pDataObj, LPCWSTR *pArguments) {
HRESULT hr;
DROPFILES *pdropfiles;
STGMEDIUM medium;
FORMATETC fmt = {
CF_HDROP,
NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL
};
hr = pDataObj->GetData(&fmt, &medium);
if (FAILED(hr)) {
OutputDebugString(L"PyShellExt::GetArguments - failed to get CF_HDROP format");
return hr;
}
if (!medium.hGlobal) {
OutputDebugString(L"PyShellExt::GetArguments - CF_HDROP format had NULL hGlobal");
ReleaseStgMedium(&medium);
return E_FAIL;
}
pdropfiles = (DROPFILES*)GlobalLock(medium.hGlobal);
if (!pdropfiles) {
OutputDebugString(L"PyShellExt::GetArguments - failed to lock CF_HDROP hGlobal");
ReleaseStgMedium(&medium);
return E_FAIL;
}
if (pdropfiles->fWide) {
LPCWSTR files = (LPCWSTR)((char*)pdropfiles + pdropfiles->pFiles);
size_t len, count;
hr = FilenameListCchLengthW(files, 32767, &len, &count);
if (SUCCEEDED(hr)) {
LPWSTR args = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
if (args) {
hr = FilenameListCchCopyW(args, 32767, files, L" ");
if (SUCCEEDED(hr)) {
*pArguments = args;
} else {
CoTaskMemFree(args);
}
} else {
hr = E_OUTOFMEMORY;
}
}
} else {
LPCSTR files = (LPCSTR)((char*)pdropfiles + pdropfiles->pFiles);
size_t len, count;
hr = FilenameListCchLengthA(files, 32767, &len, &count);
if (SUCCEEDED(hr)) {
LPSTR temp = (LPSTR)CoTaskMemAlloc(sizeof(CHAR) * (len + 1));
if (temp) {
hr = FilenameListCchCopyA(temp, 32767, files, " ");
if (SUCCEEDED(hr)) {
int wlen = MultiByteToWideChar(CP_ACP, 0, temp, (int)len, NULL, 0);
if (wlen) {
LPWSTR args = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (wlen + 1));
if (MultiByteToWideChar(CP_ACP, 0, temp, (int)len, args, wlen + 1)) {
*pArguments = args;
} else {
OutputDebugString(L"PyShellExt::GetArguments - failed to convert multi-byte to wide-char path");
CoTaskMemFree(args);
hr = E_FAIL;
}
} else {
OutputDebugString(L"PyShellExt::GetArguments - failed to get length of wide-char path");
hr = E_FAIL;
}
}
CoTaskMemFree(temp);
} else {
hr = E_OUTOFMEMORY;
}
}
}
GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium);
return hr;
}
HRESULT NotifyDragWindow(HWND hwnd) {
LRESULT res;
if (!hwnd) {
return S_FALSE;
}
res = SendMessage(hwnd, DDWM_UPDATEWINDOW, 0, NULL);
if (res) {
OutputDebugString(L"PyShellExt::NotifyDragWindow - failed to post DDWM_UPDATEWINDOW");
return E_FAIL;
}
return S_OK;
}
public:
// IDropTarget implementation
STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) {
HWND hwnd;
OutputDebugString(L"PyShellExt::DragEnter");
pDataObj->AddRef();
data_obj = pDataObj;
*pdwEffect = DROPEFFECT_MOVE;
if (FAILED(UpdateDropDescription(data_obj))) {
OutputDebugString(L"PyShellExt::DragEnter - failed to update drop description");
}
if (FAILED(GetDragWindow(data_obj, &hwnd))) {
OutputDebugString(L"PyShellExt::DragEnter - failed to get drag window");
}
if (FAILED(NotifyDragWindow(hwnd))) {
OutputDebugString(L"PyShellExt::DragEnter - failed to notify drag window");
}
return S_OK;
}
STDMETHODIMP DragLeave() {
return S_OK;
}
STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) {
return S_OK;
}
STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) {
LPCWSTR args;
OutputDebugString(L"PyShellExt::Drop");
*pdwEffect = DROPEFFECT_NONE;
if (pDataObj != data_obj) {
OutputDebugString(L"PyShellExt::Drop - unexpected data object");
return E_FAIL;
}
data_obj->Release();
data_obj = NULL;
if (SUCCEEDED(GetArguments(pDataObj, &args))) {
OutputDebugString(args);
ShellExecute(NULL, NULL, target, args, target_dir, SW_NORMAL);
CoTaskMemFree((LPVOID)args);
} else {
OutputDebugString(L"PyShellExt::Drop - failed to get launch arguments");
}
return S_OK;
}
// IPersistFile implementation
STDMETHODIMP GetCurFile(LPOLESTR *ppszFileName) {
HRESULT hr;
size_t len;
if (!ppszFileName) {
return E_POINTER;
}
hr = StringCchLength(target, STRSAFE_MAX_CCH - 1, &len);
if (FAILED(hr)) {
return E_FAIL;
}
*ppszFileName = (LPOLESTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
if (!*ppszFileName) {
return E_OUTOFMEMORY;
}
hr = StringCchCopy(*ppszFileName, len + 1, target);
if (FAILED(hr)) {
CoTaskMemFree(*ppszFileName);
*ppszFileName = NULL;
return E_FAIL;
}
return S_OK;
}
STDMETHODIMP IsDirty() {
return S_FALSE;
}
STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode) {
HRESULT hr;
size_t len;
OutputDebugString(L"PyShellExt::Load");
OutputDebugString(pszFileName);
hr = StringCchLength(pszFileName, STRSAFE_MAX_CCH - 1, &len);
if (FAILED(hr)) {
OutputDebugString(L"PyShellExt::Load - failed to get string length");
return hr;
}
if (target) {
CoTaskMemFree(target);
}
if (target_dir) {
CoTaskMemFree(target_dir);
}
target = (LPOLESTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
if (!target) {
OutputDebugString(L"PyShellExt::Load - E_OUTOFMEMORY");
return E_OUTOFMEMORY;
}
target_dir = (LPOLESTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
if (!target_dir) {
OutputDebugString(L"PyShellExt::Load - E_OUTOFMEMORY");
return E_OUTOFMEMORY;
}
hr = StringCchCopy(target, len + 1, pszFileName);
if (FAILED(hr)) {
OutputDebugString(L"PyShellExt::Load - failed to copy string");
return hr;
}
hr = StringCchCopy(target_dir, len + 1, pszFileName);
if (FAILED(hr)) {
OutputDebugString(L"PyShellExt::Load - failed to copy string");
return hr;
}
if (!PathRemoveFileSpecW(target_dir)) {
OutputDebugStringW(L"PyShellExt::Load - failed to remove filespec from target");
return E_FAIL;
}
OutputDebugString(target);
target_mode = dwMode;
OutputDebugString(L"PyShellExt::Load - S_OK");
return S_OK;
}
STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember) {
return E_NOTIMPL;
}
STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName) {
return E_NOTIMPL;
}
STDMETHODIMP GetClassID(CLSID *pClassID) {
*pClassID = CLSID_PyShellExt;
return S_OK;
}
};
CoCreatableClass(PyShellExt);
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, _COM_Outptr_ void** ppv) {
return Module<InProc>::GetModule().GetClassObject(rclsid, riid, ppv);
}
STDAPI DllCanUnloadNow() {
return Module<InProc>::GetModule().Terminate() ? S_OK : S_FALSE;
}
STDAPI DllRegisterServer() {
LONG res;
SECURITY_ATTRIBUTES secattr = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE };
LPSECURITY_ATTRIBUTES psecattr = NULL;
HKEY key, ipsKey;
WCHAR modname[MAX_PATH];
DWORD modname_len;
OutputDebugString(L"PyShellExt::DllRegisterServer");
if (!hModule) {
OutputDebugString(L"PyShellExt::DllRegisterServer - module handle was not set");
return SELFREG_E_CLASS;
}
modname_len = GetModuleFileName(hModule, modname, MAX_PATH);
if (modname_len == 0 ||
(modname_len == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to get module file name");
return SELFREG_E_CLASS;
}
DWORD disp;
res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, CLASS_SUBKEY, 0, NULL, 0,
KEY_ALL_ACCESS, psecattr, &key, &disp);
if (res == ERROR_ACCESS_DENIED) {
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to write per-machine registration. Attempting per-user instead.");
res = RegCreateKeyEx(HKEY_CURRENT_USER, CLASS_SUBKEY, 0, NULL, 0,
KEY_ALL_ACCESS, psecattr, &key, &disp);
}
if (res != ERROR_SUCCESS) {
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to create class key");
return SELFREG_E_CLASS;
}
res = RegCreateKeyEx(key, L"InProcServer32", 0, NULL, 0,
KEY_ALL_ACCESS, psecattr, &ipsKey, NULL);
if (res != ERROR_SUCCESS) {
RegCloseKey(key);
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to create InProcServer32 key");
return SELFREG_E_CLASS;
}
res = RegSetValueEx(ipsKey, NULL, 0,
REG_SZ, (LPBYTE)modname, modname_len * sizeof(modname[0]));
if (res != ERROR_SUCCESS) {
RegCloseKey(ipsKey);
RegCloseKey(key);
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to set server path");
return SELFREG_E_CLASS;
}
res = RegSetValueEx(ipsKey, L"ThreadingModel", 0,
REG_SZ, (LPBYTE)(L"Apartment"), sizeof(L"Apartment"));
RegCloseKey(ipsKey);
RegCloseKey(key);
if (res != ERROR_SUCCESS) {
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to set threading model");
return SELFREG_E_CLASS;
}
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
OutputDebugString(L"PyShellExt::DllRegisterServer - S_OK");
return S_OK;
}
STDAPI DllUnregisterServer() {
LONG res_lm, res_cu;
res_lm = RegDeleteTree(HKEY_LOCAL_MACHINE, CLASS_SUBKEY);
if (res_lm != ERROR_SUCCESS && res_lm != ERROR_FILE_NOT_FOUND) {
OutputDebugString(L"PyShellExt::DllUnregisterServer - failed to delete per-machine registration");
return SELFREG_E_CLASS;
}
res_cu = RegDeleteTree(HKEY_CURRENT_USER, CLASS_SUBKEY);
if (res_cu != ERROR_SUCCESS && res_cu != ERROR_FILE_NOT_FOUND) {
OutputDebugString(L"PyShellExt::DllUnregisterServer - failed to delete per-user registration");
return SELFREG_E_CLASS;
}
if (res_lm == ERROR_FILE_NOT_FOUND && res_cu == ERROR_FILE_NOT_FOUND) {
OutputDebugString(L"PyShellExt::DllUnregisterServer - extension was not registered");
return SELFREG_E_CLASS;
}
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
OutputDebugString(L"PyShellExt::DllUnregisterServer - S_OK");
return S_OK;
}
STDAPI_(BOOL) DllMain(_In_opt_ HINSTANCE hinst, DWORD reason, _In_opt_ void*) {
if (reason == DLL_PROCESS_ATTACH) {
hModule = hinst;
cfDropDescription = RegisterClipboardFormat(CFSTR_DROPDESCRIPTION);
if (!cfDropDescription) {
OutputDebugString(L"PyShellExt::DllMain - failed to get CFSTR_DROPDESCRIPTION format");
}
cfDragWindow = RegisterClipboardFormat(L"DragWindow");
if (!cfDragWindow) {
OutputDebugString(L"PyShellExt::DllMain - failed to get DragWindow format");
}
DisableThreadLibraryCalls(hinst);
}
return TRUE;
}

View File

@ -0,0 +1,6 @@
LIBRARY "pyshellext"
EXPORTS
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE

View File

@ -0,0 +1,12 @@
import "ocidl.idl";
[uuid(44039A76-3BDD-41C1-A31B-71C00202CE81), version(1.0)]
library PyShellExtLib
{
[uuid(BEA218D2-6950-497B-9434-61683EC065FE), version(1.0)]
coclass PyShellExt
{
[default] interface IDropTarget;
interface IPersistFile;
}
};

View File

@ -0,0 +1,46 @@
#include <windows.h>
#include "python_ver_rc.h"
// Include the manifest file that indicates we support all
// current versions of Windows.
#include <winuser.h>
1 RT_MANIFEST "python.manifest"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION PYVERSION64
PRODUCTVERSION PYVERSION64
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", PYTHON_COMPANY "\0"
VALUE "FileDescription", "Python\0"
VALUE "FileVersion", PYTHON_VERSION
VALUE "InternalName", "Python Launcher Shell Extension\0"
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
VALUE "OriginalFilename", "pyshellext" PYTHON_DEBUG_EXT ".dll\0"
VALUE "ProductName", "Python\0"
VALUE "ProductVersion", PYTHON_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

View File

@ -0,0 +1,6 @@
LIBRARY "pyshellext_d"
EXPORTS
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
</assembly>

View File

@ -0,0 +1,811 @@
; This file specifies the import forwarding for python3.dll
; It is used when building python3dll.vcxproj
LIBRARY "python3"
EXPORTS
PyArg_Parse=python39.PyArg_Parse
PyArg_ParseTuple=python39.PyArg_ParseTuple
PyArg_ParseTupleAndKeywords=python39.PyArg_ParseTupleAndKeywords
PyArg_UnpackTuple=python39.PyArg_UnpackTuple
PyArg_VaParse=python39.PyArg_VaParse
PyArg_VaParseTupleAndKeywords=python39.PyArg_VaParseTupleAndKeywords
PyArg_ValidateKeywordArguments=python39.PyArg_ValidateKeywordArguments
PyBaseObject_Type=python39.PyBaseObject_Type DATA
PyBool_FromLong=python39.PyBool_FromLong
PyBool_Type=python39.PyBool_Type DATA
PyByteArrayIter_Type=python39.PyByteArrayIter_Type DATA
PyByteArray_AsString=python39.PyByteArray_AsString
PyByteArray_Concat=python39.PyByteArray_Concat
PyByteArray_FromObject=python39.PyByteArray_FromObject
PyByteArray_FromStringAndSize=python39.PyByteArray_FromStringAndSize
PyByteArray_Resize=python39.PyByteArray_Resize
PyByteArray_Size=python39.PyByteArray_Size
PyByteArray_Type=python39.PyByteArray_Type DATA
PyBytesIter_Type=python39.PyBytesIter_Type DATA
PyBytes_AsString=python39.PyBytes_AsString
PyBytes_AsStringAndSize=python39.PyBytes_AsStringAndSize
PyBytes_Concat=python39.PyBytes_Concat
PyBytes_ConcatAndDel=python39.PyBytes_ConcatAndDel
PyBytes_DecodeEscape=python39.PyBytes_DecodeEscape
PyBytes_FromFormat=python39.PyBytes_FromFormat
PyBytes_FromFormatV=python39.PyBytes_FromFormatV
PyBytes_FromObject=python39.PyBytes_FromObject
PyBytes_FromString=python39.PyBytes_FromString
PyBytes_FromStringAndSize=python39.PyBytes_FromStringAndSize
PyBytes_Repr=python39.PyBytes_Repr
PyBytes_Size=python39.PyBytes_Size
PyBytes_Type=python39.PyBytes_Type DATA
PyCFunction_Call=python39.PyCFunction_Call
PyCFunction_GetFlags=python39.PyCFunction_GetFlags
PyCFunction_GetFunction=python39.PyCFunction_GetFunction
PyCFunction_GetSelf=python39.PyCFunction_GetSelf
PyCFunction_New=python39.PyCFunction_New
PyCFunction_NewEx=python39.PyCFunction_NewEx
PyCMethod_New=python39.PyCMethod_New
PyCFunction_Type=python39.PyCFunction_Type DATA
PyCallIter_New=python39.PyCallIter_New
PyCallIter_Type=python39.PyCallIter_Type DATA
PyCallable_Check=python39.PyCallable_Check
PyCapsule_GetContext=python39.PyCapsule_GetContext
PyCapsule_GetDestructor=python39.PyCapsule_GetDestructor
PyCapsule_GetName=python39.PyCapsule_GetName
PyCapsule_GetPointer=python39.PyCapsule_GetPointer
PyCapsule_Import=python39.PyCapsule_Import
PyCapsule_IsValid=python39.PyCapsule_IsValid
PyCapsule_New=python39.PyCapsule_New
PyCapsule_SetContext=python39.PyCapsule_SetContext
PyCapsule_SetDestructor=python39.PyCapsule_SetDestructor
PyCapsule_SetName=python39.PyCapsule_SetName
PyCapsule_SetPointer=python39.PyCapsule_SetPointer
PyCapsule_Type=python39.PyCapsule_Type DATA
PyClassMethodDescr_Type=python39.PyClassMethodDescr_Type DATA
PyCodec_BackslashReplaceErrors=python39.PyCodec_BackslashReplaceErrors
PyCodec_Decode=python39.PyCodec_Decode
PyCodec_Decoder=python39.PyCodec_Decoder
PyCodec_Encode=python39.PyCodec_Encode
PyCodec_Encoder=python39.PyCodec_Encoder
PyCodec_IgnoreErrors=python39.PyCodec_IgnoreErrors
PyCodec_IncrementalDecoder=python39.PyCodec_IncrementalDecoder
PyCodec_IncrementalEncoder=python39.PyCodec_IncrementalEncoder
PyCodec_KnownEncoding=python39.PyCodec_KnownEncoding
PyCodec_LookupError=python39.PyCodec_LookupError
PyCodec_NameReplaceErrors=python39.PyCodec_NameReplaceErrors
PyCodec_Register=python39.PyCodec_Register
PyCodec_RegisterError=python39.PyCodec_RegisterError
PyCodec_ReplaceErrors=python39.PyCodec_ReplaceErrors
PyCodec_StreamReader=python39.PyCodec_StreamReader
PyCodec_StreamWriter=python39.PyCodec_StreamWriter
PyCodec_StrictErrors=python39.PyCodec_StrictErrors
PyCodec_XMLCharRefReplaceErrors=python39.PyCodec_XMLCharRefReplaceErrors
PyComplex_FromDoubles=python39.PyComplex_FromDoubles
PyComplex_ImagAsDouble=python39.PyComplex_ImagAsDouble
PyComplex_RealAsDouble=python39.PyComplex_RealAsDouble
PyComplex_Type=python39.PyComplex_Type DATA
PyDescr_NewClassMethod=python39.PyDescr_NewClassMethod
PyDescr_NewGetSet=python39.PyDescr_NewGetSet
PyDescr_NewMember=python39.PyDescr_NewMember
PyDescr_NewMethod=python39.PyDescr_NewMethod
PyDictItems_Type=python39.PyDictItems_Type DATA
PyDictIterItem_Type=python39.PyDictIterItem_Type DATA
PyDictIterKey_Type=python39.PyDictIterKey_Type DATA
PyDictIterValue_Type=python39.PyDictIterValue_Type DATA
PyDictKeys_Type=python39.PyDictKeys_Type DATA
PyDictProxy_New=python39.PyDictProxy_New
PyDictProxy_Type=python39.PyDictProxy_Type DATA
PyDictValues_Type=python39.PyDictValues_Type DATA
PyDict_Clear=python39.PyDict_Clear
PyDict_Contains=python39.PyDict_Contains
PyDict_Copy=python39.PyDict_Copy
PyDict_DelItem=python39.PyDict_DelItem
PyDict_DelItemString=python39.PyDict_DelItemString
PyDict_GetItem=python39.PyDict_GetItem
PyDict_GetItemString=python39.PyDict_GetItemString
PyDict_GetItemWithError=python39.PyDict_GetItemWithError
PyDict_Items=python39.PyDict_Items
PyDict_Keys=python39.PyDict_Keys
PyDict_Merge=python39.PyDict_Merge
PyDict_MergeFromSeq2=python39.PyDict_MergeFromSeq2
PyDict_New=python39.PyDict_New
PyDict_Next=python39.PyDict_Next
PyDict_SetItem=python39.PyDict_SetItem
PyDict_SetItemString=python39.PyDict_SetItemString
PyDict_Size=python39.PyDict_Size
PyDict_Type=python39.PyDict_Type DATA
PyDict_Update=python39.PyDict_Update
PyDict_Values=python39.PyDict_Values
PyEllipsis_Type=python39.PyEllipsis_Type DATA
PyEnum_Type=python39.PyEnum_Type DATA
PyErr_BadArgument=python39.PyErr_BadArgument
PyErr_BadInternalCall=python39.PyErr_BadInternalCall
PyErr_CheckSignals=python39.PyErr_CheckSignals
PyErr_Clear=python39.PyErr_Clear
PyErr_Display=python39.PyErr_Display
PyErr_ExceptionMatches=python39.PyErr_ExceptionMatches
PyErr_Fetch=python39.PyErr_Fetch
PyErr_Format=python39.PyErr_Format
PyErr_FormatV=python39.PyErr_FormatV
PyErr_GetExcInfo=python39.PyErr_GetExcInfo
PyErr_GivenExceptionMatches=python39.PyErr_GivenExceptionMatches
PyErr_NewException=python39.PyErr_NewException
PyErr_NewExceptionWithDoc=python39.PyErr_NewExceptionWithDoc
PyErr_NoMemory=python39.PyErr_NoMemory
PyErr_NormalizeException=python39.PyErr_NormalizeException
PyErr_Occurred=python39.PyErr_Occurred
PyErr_Print=python39.PyErr_Print
PyErr_PrintEx=python39.PyErr_PrintEx
PyErr_ProgramText=python39.PyErr_ProgramText
PyErr_ResourceWarning=python39.PyErr_ResourceWarning
PyErr_Restore=python39.PyErr_Restore
PyErr_SetExcFromWindowsErr=python39.PyErr_SetExcFromWindowsErr
PyErr_SetExcFromWindowsErrWithFilename=python39.PyErr_SetExcFromWindowsErrWithFilename
PyErr_SetExcFromWindowsErrWithFilenameObject=python39.PyErr_SetExcFromWindowsErrWithFilenameObject
PyErr_SetExcFromWindowsErrWithFilenameObjects=python39.PyErr_SetExcFromWindowsErrWithFilenameObjects
PyErr_SetExcInfo=python39.PyErr_SetExcInfo
PyErr_SetFromErrno=python39.PyErr_SetFromErrno
PyErr_SetFromErrnoWithFilename=python39.PyErr_SetFromErrnoWithFilename
PyErr_SetFromErrnoWithFilenameObject=python39.PyErr_SetFromErrnoWithFilenameObject
PyErr_SetFromErrnoWithFilenameObjects=python39.PyErr_SetFromErrnoWithFilenameObjects
PyErr_SetFromWindowsErr=python39.PyErr_SetFromWindowsErr
PyErr_SetFromWindowsErrWithFilename=python39.PyErr_SetFromWindowsErrWithFilename
PyErr_SetImportError=python39.PyErr_SetImportError
PyErr_SetImportErrorSubclass=python39.PyErr_SetImportErrorSubclass
PyErr_SetInterrupt=python39.PyErr_SetInterrupt
PyErr_SetNone=python39.PyErr_SetNone
PyErr_SetObject=python39.PyErr_SetObject
PyErr_SetString=python39.PyErr_SetString
PyErr_SyntaxLocation=python39.PyErr_SyntaxLocation
PyErr_SyntaxLocationEx=python39.PyErr_SyntaxLocationEx
PyErr_WarnEx=python39.PyErr_WarnEx
PyErr_WarnExplicit=python39.PyErr_WarnExplicit
PyErr_WarnFormat=python39.PyErr_WarnFormat
PyErr_WriteUnraisable=python39.PyErr_WriteUnraisable
PyEval_AcquireLock=python39.PyEval_AcquireLock
PyEval_AcquireThread=python39.PyEval_AcquireThread
PyEval_CallFunction=python39.PyEval_CallFunction
PyEval_CallMethod=python39.PyEval_CallMethod
PyEval_CallObjectWithKeywords=python39.PyEval_CallObjectWithKeywords
PyEval_EvalCode=python39.PyEval_EvalCode
PyEval_EvalCodeEx=python39.PyEval_EvalCodeEx
PyEval_EvalFrame=python39.PyEval_EvalFrame
PyEval_EvalFrameEx=python39.PyEval_EvalFrameEx
PyEval_GetBuiltins=python39.PyEval_GetBuiltins
PyEval_GetCallStats=python39.PyEval_GetCallStats
PyEval_GetFrame=python39.PyEval_GetFrame
PyEval_GetFuncDesc=python39.PyEval_GetFuncDesc
PyEval_GetFuncName=python39.PyEval_GetFuncName
PyEval_GetGlobals=python39.PyEval_GetGlobals
PyEval_GetLocals=python39.PyEval_GetLocals
PyEval_InitThreads=python39.PyEval_InitThreads
PyEval_ReInitThreads=python39.PyEval_ReInitThreads
PyEval_ReleaseLock=python39.PyEval_ReleaseLock
PyEval_ReleaseThread=python39.PyEval_ReleaseThread
PyEval_RestoreThread=python39.PyEval_RestoreThread
PyEval_SaveThread=python39.PyEval_SaveThread
PyEval_ThreadsInitialized=python39.PyEval_ThreadsInitialized
PyExc_ArithmeticError=python39.PyExc_ArithmeticError DATA
PyExc_AssertionError=python39.PyExc_AssertionError DATA
PyExc_AttributeError=python39.PyExc_AttributeError DATA
PyExc_BaseException=python39.PyExc_BaseException DATA
PyExc_BlockingIOError=python39.PyExc_BlockingIOError DATA
PyExc_BrokenPipeError=python39.PyExc_BrokenPipeError DATA
PyExc_BufferError=python39.PyExc_BufferError DATA
PyExc_BytesWarning=python39.PyExc_BytesWarning DATA
PyExc_ChildProcessError=python39.PyExc_ChildProcessError DATA
PyExc_ConnectionAbortedError=python39.PyExc_ConnectionAbortedError DATA
PyExc_ConnectionError=python39.PyExc_ConnectionError DATA
PyExc_ConnectionRefusedError=python39.PyExc_ConnectionRefusedError DATA
PyExc_ConnectionResetError=python39.PyExc_ConnectionResetError DATA
PyExc_DeprecationWarning=python39.PyExc_DeprecationWarning DATA
PyExc_EOFError=python39.PyExc_EOFError DATA
PyExc_EnvironmentError=python39.PyExc_EnvironmentError DATA
PyExc_Exception=python39.PyExc_Exception DATA
PyExc_FileExistsError=python39.PyExc_FileExistsError DATA
PyExc_FileNotFoundError=python39.PyExc_FileNotFoundError DATA
PyExc_FloatingPointError=python39.PyExc_FloatingPointError DATA
PyExc_FutureWarning=python39.PyExc_FutureWarning DATA
PyExc_GeneratorExit=python39.PyExc_GeneratorExit DATA
PyExc_IOError=python39.PyExc_IOError DATA
PyExc_ImportError=python39.PyExc_ImportError DATA
PyExc_ImportWarning=python39.PyExc_ImportWarning DATA
PyExc_IndentationError=python39.PyExc_IndentationError DATA
PyExc_IndexError=python39.PyExc_IndexError DATA
PyExc_InterruptedError=python39.PyExc_InterruptedError DATA
PyExc_IsADirectoryError=python39.PyExc_IsADirectoryError DATA
PyExc_KeyError=python39.PyExc_KeyError DATA
PyExc_KeyboardInterrupt=python39.PyExc_KeyboardInterrupt DATA
PyExc_LookupError=python39.PyExc_LookupError DATA
PyExc_MemoryError=python39.PyExc_MemoryError DATA
PyExc_ModuleNotFoundError=python39.PyExc_ModuleNotFoundError DATA
PyExc_NameError=python39.PyExc_NameError DATA
PyExc_NotADirectoryError=python39.PyExc_NotADirectoryError DATA
PyExc_NotImplementedError=python39.PyExc_NotImplementedError DATA
PyExc_OSError=python39.PyExc_OSError DATA
PyExc_OverflowError=python39.PyExc_OverflowError DATA
PyExc_PendingDeprecationWarning=python39.PyExc_PendingDeprecationWarning DATA
PyExc_PermissionError=python39.PyExc_PermissionError DATA
PyExc_ProcessLookupError=python39.PyExc_ProcessLookupError DATA
PyExc_RecursionError=python39.PyExc_RecursionError DATA
PyExc_ReferenceError=python39.PyExc_ReferenceError DATA
PyExc_ResourceWarning=python39.PyExc_ResourceWarning DATA
PyExc_RuntimeError=python39.PyExc_RuntimeError DATA
PyExc_RuntimeWarning=python39.PyExc_RuntimeWarning DATA
PyExc_StopAsyncIteration=python39.PyExc_StopAsyncIteration DATA
PyExc_StopIteration=python39.PyExc_StopIteration DATA
PyExc_SyntaxError=python39.PyExc_SyntaxError DATA
PyExc_SyntaxWarning=python39.PyExc_SyntaxWarning DATA
PyExc_SystemError=python39.PyExc_SystemError DATA
PyExc_SystemExit=python39.PyExc_SystemExit DATA
PyExc_TabError=python39.PyExc_TabError DATA
PyExc_TimeoutError=python39.PyExc_TimeoutError DATA
PyExc_TypeError=python39.PyExc_TypeError DATA
PyExc_UnboundLocalError=python39.PyExc_UnboundLocalError DATA
PyExc_UnicodeDecodeError=python39.PyExc_UnicodeDecodeError DATA
PyExc_UnicodeEncodeError=python39.PyExc_UnicodeEncodeError DATA
PyExc_UnicodeError=python39.PyExc_UnicodeError DATA
PyExc_UnicodeTranslateError=python39.PyExc_UnicodeTranslateError DATA
PyExc_UnicodeWarning=python39.PyExc_UnicodeWarning DATA
PyExc_UserWarning=python39.PyExc_UserWarning DATA
PyExc_ValueError=python39.PyExc_ValueError DATA
PyExc_Warning=python39.PyExc_Warning DATA
PyExc_WindowsError=python39.PyExc_WindowsError DATA
PyExc_ZeroDivisionError=python39.PyExc_ZeroDivisionError DATA
PyExceptionClass_Name=python39.PyExceptionClass_Name
PyException_GetCause=python39.PyException_GetCause
PyException_GetContext=python39.PyException_GetContext
PyException_GetTraceback=python39.PyException_GetTraceback
PyException_SetCause=python39.PyException_SetCause
PyException_SetContext=python39.PyException_SetContext
PyException_SetTraceback=python39.PyException_SetTraceback
PyFile_FromFd=python39.PyFile_FromFd
PyFile_GetLine=python39.PyFile_GetLine
PyFile_WriteObject=python39.PyFile_WriteObject
PyFile_WriteString=python39.PyFile_WriteString
PyFilter_Type=python39.PyFilter_Type DATA
PyFloat_AsDouble=python39.PyFloat_AsDouble
PyFloat_FromDouble=python39.PyFloat_FromDouble
PyFloat_FromString=python39.PyFloat_FromString
PyFloat_GetInfo=python39.PyFloat_GetInfo
PyFloat_GetMax=python39.PyFloat_GetMax
PyFloat_GetMin=python39.PyFloat_GetMin
PyFloat_Type=python39.PyFloat_Type DATA
PyFrame_GetCode=python39.PyFrame_GetCode
PyFrame_GetLineNumber=python39.PyFrame_GetLineNumber
PyFrozenSet_New=python39.PyFrozenSet_New
PyFrozenSet_Type=python39.PyFrozenSet_Type DATA
PyGC_Collect=python39.PyGC_Collect
PyGILState_Ensure=python39.PyGILState_Ensure
PyGILState_GetThisThreadState=python39.PyGILState_GetThisThreadState
PyGILState_Release=python39.PyGILState_Release
PyGetSetDescr_Type=python39.PyGetSetDescr_Type DATA
PyImport_AddModule=python39.PyImport_AddModule
PyImport_AddModuleObject=python39.PyImport_AddModuleObject
PyImport_AppendInittab=python39.PyImport_AppendInittab
PyImport_Cleanup=python39.PyImport_Cleanup
PyImport_ExecCodeModule=python39.PyImport_ExecCodeModule
PyImport_ExecCodeModuleEx=python39.PyImport_ExecCodeModuleEx
PyImport_ExecCodeModuleObject=python39.PyImport_ExecCodeModuleObject
PyImport_ExecCodeModuleWithPathnames=python39.PyImport_ExecCodeModuleWithPathnames
PyImport_GetImporter=python39.PyImport_GetImporter
PyImport_GetMagicNumber=python39.PyImport_GetMagicNumber
PyImport_GetMagicTag=python39.PyImport_GetMagicTag
PyImport_GetModule=python39.PyImport_GetModule
PyImport_GetModuleDict=python39.PyImport_GetModuleDict
PyImport_Import=python39.PyImport_Import
PyImport_ImportFrozenModule=python39.PyImport_ImportFrozenModule
PyImport_ImportFrozenModuleObject=python39.PyImport_ImportFrozenModuleObject
PyImport_ImportModule=python39.PyImport_ImportModule
PyImport_ImportModuleLevel=python39.PyImport_ImportModuleLevel
PyImport_ImportModuleLevelObject=python39.PyImport_ImportModuleLevelObject
PyImport_ImportModuleNoBlock=python39.PyImport_ImportModuleNoBlock
PyImport_ReloadModule=python39.PyImport_ReloadModule
PyIndex_Check=python39.PyIndex_Check
PyInterpreterState_Clear=python39.PyInterpreterState_Clear
PyInterpreterState_Delete=python39.PyInterpreterState_Delete
PyInterpreterState_New=python39.PyInterpreterState_New
PyIter_Check=python39.PyIter_Check
PyIter_Next=python39.PyIter_Next
PyListIter_Type=python39.PyListIter_Type DATA
PyListRevIter_Type=python39.PyListRevIter_Type DATA
PyList_Append=python39.PyList_Append
PyList_AsTuple=python39.PyList_AsTuple
PyList_GetItem=python39.PyList_GetItem
PyList_GetSlice=python39.PyList_GetSlice
PyList_Insert=python39.PyList_Insert
PyList_New=python39.PyList_New
PyList_Reverse=python39.PyList_Reverse
PyList_SetItem=python39.PyList_SetItem
PyList_SetSlice=python39.PyList_SetSlice
PyList_Size=python39.PyList_Size
PyList_Sort=python39.PyList_Sort
PyList_Type=python39.PyList_Type DATA
PyLongRangeIter_Type=python39.PyLongRangeIter_Type DATA
PyLong_AsDouble=python39.PyLong_AsDouble
PyLong_AsLong=python39.PyLong_AsLong
PyLong_AsLongAndOverflow=python39.PyLong_AsLongAndOverflow
PyLong_AsLongLong=python39.PyLong_AsLongLong
PyLong_AsLongLongAndOverflow=python39.PyLong_AsLongLongAndOverflow
PyLong_AsSize_t=python39.PyLong_AsSize_t
PyLong_AsSsize_t=python39.PyLong_AsSsize_t
PyLong_AsUnsignedLong=python39.PyLong_AsUnsignedLong
PyLong_AsUnsignedLongLong=python39.PyLong_AsUnsignedLongLong
PyLong_AsUnsignedLongLongMask=python39.PyLong_AsUnsignedLongLongMask
PyLong_AsUnsignedLongMask=python39.PyLong_AsUnsignedLongMask
PyLong_AsVoidPtr=python39.PyLong_AsVoidPtr
PyLong_FromDouble=python39.PyLong_FromDouble
PyLong_FromLong=python39.PyLong_FromLong
PyLong_FromLongLong=python39.PyLong_FromLongLong
PyLong_FromSize_t=python39.PyLong_FromSize_t
PyLong_FromSsize_t=python39.PyLong_FromSsize_t
PyLong_FromString=python39.PyLong_FromString
PyLong_FromUnsignedLong=python39.PyLong_FromUnsignedLong
PyLong_FromUnsignedLongLong=python39.PyLong_FromUnsignedLongLong
PyLong_FromVoidPtr=python39.PyLong_FromVoidPtr
PyLong_GetInfo=python39.PyLong_GetInfo
PyLong_Type=python39.PyLong_Type DATA
PyMap_Type=python39.PyMap_Type DATA
PyMapping_Check=python39.PyMapping_Check
PyMapping_GetItemString=python39.PyMapping_GetItemString
PyMapping_HasKey=python39.PyMapping_HasKey
PyMapping_HasKeyString=python39.PyMapping_HasKeyString
PyMapping_Items=python39.PyMapping_Items
PyMapping_Keys=python39.PyMapping_Keys
PyMapping_Length=python39.PyMapping_Length
PyMapping_SetItemString=python39.PyMapping_SetItemString
PyMapping_Size=python39.PyMapping_Size
PyMapping_Values=python39.PyMapping_Values
PyMem_Calloc=python39.PyMem_Calloc
PyMem_Free=python39.PyMem_Free
PyMem_Malloc=python39.PyMem_Malloc
PyMem_Realloc=python39.PyMem_Realloc
PyMemberDescr_Type=python39.PyMemberDescr_Type DATA
PyMemoryView_FromMemory=python39.PyMemoryView_FromMemory
PyMemoryView_FromObject=python39.PyMemoryView_FromObject
PyMemoryView_GetContiguous=python39.PyMemoryView_GetContiguous
PyMemoryView_Type=python39.PyMemoryView_Type DATA
PyMethodDescr_Type=python39.PyMethodDescr_Type DATA
PyModuleDef_Init=python39.PyModuleDef_Init
PyModuleDef_Type=python39.PyModuleDef_Type DATA
PyModule_AddFunctions=python39.PyModule_AddFunctions
PyModule_AddIntConstant=python39.PyModule_AddIntConstant
PyModule_AddObject=python39.PyModule_AddObject
PyModule_AddStringConstant=python39.PyModule_AddStringConstant
PyModule_Create2=python39.PyModule_Create2
PyModule_ExecDef=python39.PyModule_ExecDef
PyModule_FromDefAndSpec2=python39.PyModule_FromDefAndSpec2
PyModule_GetDef=python39.PyModule_GetDef
PyModule_GetDict=python39.PyModule_GetDict
PyModule_GetFilename=python39.PyModule_GetFilename
PyModule_GetFilenameObject=python39.PyModule_GetFilenameObject
PyModule_GetName=python39.PyModule_GetName
PyModule_GetNameObject=python39.PyModule_GetNameObject
PyModule_GetState=python39.PyModule_GetState
PyModule_New=python39.PyModule_New
PyModule_NewObject=python39.PyModule_NewObject
PyModule_SetDocString=python39.PyModule_SetDocString
PyModule_Type=python39.PyModule_Type DATA
PyNullImporter_Type=python39.PyNullImporter_Type DATA
PyNumber_Absolute=python39.PyNumber_Absolute
PyNumber_Add=python39.PyNumber_Add
PyNumber_And=python39.PyNumber_And
PyNumber_AsSsize_t=python39.PyNumber_AsSsize_t
PyNumber_Check=python39.PyNumber_Check
PyNumber_Divmod=python39.PyNumber_Divmod
PyNumber_Float=python39.PyNumber_Float
PyNumber_FloorDivide=python39.PyNumber_FloorDivide
PyNumber_InPlaceAdd=python39.PyNumber_InPlaceAdd
PyNumber_InPlaceAnd=python39.PyNumber_InPlaceAnd
PyNumber_InPlaceFloorDivide=python39.PyNumber_InPlaceFloorDivide
PyNumber_InPlaceLshift=python39.PyNumber_InPlaceLshift
PyNumber_InPlaceMatrixMultiply=python39.PyNumber_InPlaceMatrixMultiply
PyNumber_InPlaceMultiply=python39.PyNumber_InPlaceMultiply
PyNumber_InPlaceOr=python39.PyNumber_InPlaceOr
PyNumber_InPlacePower=python39.PyNumber_InPlacePower
PyNumber_InPlaceRemainder=python39.PyNumber_InPlaceRemainder
PyNumber_InPlaceRshift=python39.PyNumber_InPlaceRshift
PyNumber_InPlaceSubtract=python39.PyNumber_InPlaceSubtract
PyNumber_InPlaceTrueDivide=python39.PyNumber_InPlaceTrueDivide
PyNumber_InPlaceXor=python39.PyNumber_InPlaceXor
PyNumber_Index=python39.PyNumber_Index
PyNumber_Invert=python39.PyNumber_Invert
PyNumber_Long=python39.PyNumber_Long
PyNumber_Lshift=python39.PyNumber_Lshift
PyNumber_MatrixMultiply=python39.PyNumber_MatrixMultiply
PyNumber_Multiply=python39.PyNumber_Multiply
PyNumber_Negative=python39.PyNumber_Negative
PyNumber_Or=python39.PyNumber_Or
PyNumber_Positive=python39.PyNumber_Positive
PyNumber_Power=python39.PyNumber_Power
PyNumber_Remainder=python39.PyNumber_Remainder
PyNumber_Rshift=python39.PyNumber_Rshift
PyNumber_Subtract=python39.PyNumber_Subtract
PyNumber_ToBase=python39.PyNumber_ToBase
PyNumber_TrueDivide=python39.PyNumber_TrueDivide
PyNumber_Xor=python39.PyNumber_Xor
PyODictItems_Type=python39.PyODictItems_Type DATA
PyODictIter_Type=python39.PyODictIter_Type DATA
PyODictKeys_Type=python39.PyODictKeys_Type DATA
PyODictValues_Type=python39.PyODictValues_Type DATA
PyODict_DelItem=python39.PyODict_DelItem
PyODict_New=python39.PyODict_New
PyODict_SetItem=python39.PyODict_SetItem
PyODict_Type=python39.PyODict_Type DATA
PyOS_AfterFork=python39.PyOS_AfterFork
PyOS_CheckStack=python39.PyOS_CheckStack
PyOS_FSPath=python39.PyOS_FSPath
PyOS_InitInterrupts=python39.PyOS_InitInterrupts
PyOS_InputHook=python39.PyOS_InputHook DATA
PyOS_InterruptOccurred=python39.PyOS_InterruptOccurred
PyOS_ReadlineFunctionPointer=python39.PyOS_ReadlineFunctionPointer DATA
PyOS_double_to_string=python39.PyOS_double_to_string
PyOS_getsig=python39.PyOS_getsig
PyOS_mystricmp=python39.PyOS_mystricmp
PyOS_mystrnicmp=python39.PyOS_mystrnicmp
PyOS_setsig=python39.PyOS_setsig
PyOS_snprintf=python39.PyOS_snprintf
PyOS_string_to_double=python39.PyOS_string_to_double
PyOS_strtol=python39.PyOS_strtol
PyOS_strtoul=python39.PyOS_strtoul
PyOS_vsnprintf=python39.PyOS_vsnprintf
PyObject_ASCII=python39.PyObject_ASCII
PyObject_AsCharBuffer=python39.PyObject_AsCharBuffer
PyObject_AsFileDescriptor=python39.PyObject_AsFileDescriptor
PyObject_AsReadBuffer=python39.PyObject_AsReadBuffer
PyObject_AsWriteBuffer=python39.PyObject_AsWriteBuffer
PyObject_Bytes=python39.PyObject_Bytes
PyObject_Call=python39.PyObject_Call
PyObject_CallFunction=python39.PyObject_CallFunction
PyObject_CallFunctionObjArgs=python39.PyObject_CallFunctionObjArgs
PyObject_CallMethod=python39.PyObject_CallMethod
PyObject_CallMethodObjArgs=python39.PyObject_CallMethodObjArgs
PyObject_CallNoArgs=python39.PyObject_CallNoArgs
PyObject_CallObject=python39.PyObject_CallObject
PyObject_Calloc=python39.PyObject_Calloc
PyObject_CheckReadBuffer=python39.PyObject_CheckReadBuffer
PyObject_ClearWeakRefs=python39.PyObject_ClearWeakRefs
PyObject_DelItem=python39.PyObject_DelItem
PyObject_DelItemString=python39.PyObject_DelItemString
PyObject_Dir=python39.PyObject_Dir
PyObject_Format=python39.PyObject_Format
PyObject_Free=python39.PyObject_Free
PyObject_GC_Del=python39.PyObject_GC_Del
PyObject_GC_Track=python39.PyObject_GC_Track
PyObject_GC_UnTrack=python39.PyObject_GC_UnTrack
PyObject_GenericGetAttr=python39.PyObject_GenericGetAttr
PyObject_GenericSetAttr=python39.PyObject_GenericSetAttr
PyObject_GenericSetDict=python39.PyObject_GenericSetDict
PyObject_GetAttr=python39.PyObject_GetAttr
PyObject_GetAttrString=python39.PyObject_GetAttrString
PyObject_GetItem=python39.PyObject_GetItem
PyObject_GetIter=python39.PyObject_GetIter
PyObject_HasAttr=python39.PyObject_HasAttr
PyObject_HasAttrString=python39.PyObject_HasAttrString
PyObject_Hash=python39.PyObject_Hash
PyObject_HashNotImplemented=python39.PyObject_HashNotImplemented
PyObject_Init=python39.PyObject_Init
PyObject_InitVar=python39.PyObject_InitVar
PyObject_IsInstance=python39.PyObject_IsInstance
PyObject_IsSubclass=python39.PyObject_IsSubclass
PyObject_IsTrue=python39.PyObject_IsTrue
PyObject_Length=python39.PyObject_Length
PyObject_Malloc=python39.PyObject_Malloc
PyObject_Not=python39.PyObject_Not
PyObject_Realloc=python39.PyObject_Realloc
PyObject_Repr=python39.PyObject_Repr
PyObject_RichCompare=python39.PyObject_RichCompare
PyObject_RichCompareBool=python39.PyObject_RichCompareBool
PyObject_SelfIter=python39.PyObject_SelfIter
PyObject_SetAttr=python39.PyObject_SetAttr
PyObject_SetAttrString=python39.PyObject_SetAttrString
PyObject_SetItem=python39.PyObject_SetItem
PyObject_Size=python39.PyObject_Size
PyObject_Str=python39.PyObject_Str
PyObject_Type=python39.PyObject_Type
PyParser_SimpleParseFileFlags=python39.PyParser_SimpleParseFileFlags
PyParser_SimpleParseStringFlags=python39.PyParser_SimpleParseStringFlags
PyParser_SimpleParseStringFlagsFilename=python39.PyParser_SimpleParseStringFlagsFilename
PyProperty_Type=python39.PyProperty_Type DATA
PyRangeIter_Type=python39.PyRangeIter_Type DATA
PyRange_Type=python39.PyRange_Type DATA
PyReversed_Type=python39.PyReversed_Type DATA
PySeqIter_New=python39.PySeqIter_New
PySeqIter_Type=python39.PySeqIter_Type DATA
PySequence_Check=python39.PySequence_Check
PySequence_Concat=python39.PySequence_Concat
PySequence_Contains=python39.PySequence_Contains
PySequence_Count=python39.PySequence_Count
PySequence_DelItem=python39.PySequence_DelItem
PySequence_DelSlice=python39.PySequence_DelSlice
PySequence_Fast=python39.PySequence_Fast
PySequence_GetItem=python39.PySequence_GetItem
PySequence_GetSlice=python39.PySequence_GetSlice
PySequence_In=python39.PySequence_In
PySequence_InPlaceConcat=python39.PySequence_InPlaceConcat
PySequence_InPlaceRepeat=python39.PySequence_InPlaceRepeat
PySequence_Index=python39.PySequence_Index
PySequence_Length=python39.PySequence_Length
PySequence_List=python39.PySequence_List
PySequence_Repeat=python39.PySequence_Repeat
PySequence_SetItem=python39.PySequence_SetItem
PySequence_SetSlice=python39.PySequence_SetSlice
PySequence_Size=python39.PySequence_Size
PySequence_Tuple=python39.PySequence_Tuple
PySetIter_Type=python39.PySetIter_Type DATA
PySet_Add=python39.PySet_Add
PySet_Clear=python39.PySet_Clear
PySet_Contains=python39.PySet_Contains
PySet_Discard=python39.PySet_Discard
PySet_New=python39.PySet_New
PySet_Pop=python39.PySet_Pop
PySet_Size=python39.PySet_Size
PySet_Type=python39.PySet_Type DATA
PySlice_AdjustIndices=python39.PySlice_AdjustIndices
PySlice_GetIndices=python39.PySlice_GetIndices
PySlice_GetIndicesEx=python39.PySlice_GetIndicesEx
PySlice_New=python39.PySlice_New
PySlice_Type=python39.PySlice_Type DATA
PySlice_Unpack=python39.PySlice_Unpack
PySortWrapper_Type=python39.PySortWrapper_Type DATA
PyInterpreterState_GetID=python39.PyInterpreterState_GetID
PyState_AddModule=python39.PyState_AddModule
PyState_FindModule=python39.PyState_FindModule
PyState_RemoveModule=python39.PyState_RemoveModule
PyStructSequence_GetItem=python39.PyStructSequence_GetItem
PyStructSequence_New=python39.PyStructSequence_New
PyStructSequence_NewType=python39.PyStructSequence_NewType
PyStructSequence_SetItem=python39.PyStructSequence_SetItem
PySuper_Type=python39.PySuper_Type DATA
PySys_AddWarnOption=python39.PySys_AddWarnOption
PySys_AddWarnOptionUnicode=python39.PySys_AddWarnOptionUnicode
PySys_AddXOption=python39.PySys_AddXOption
PySys_FormatStderr=python39.PySys_FormatStderr
PySys_FormatStdout=python39.PySys_FormatStdout
PySys_GetObject=python39.PySys_GetObject
PySys_GetXOptions=python39.PySys_GetXOptions
PySys_HasWarnOptions=python39.PySys_HasWarnOptions
PySys_ResetWarnOptions=python39.PySys_ResetWarnOptions
PySys_SetArgv=python39.PySys_SetArgv
PySys_SetArgvEx=python39.PySys_SetArgvEx
PySys_SetObject=python39.PySys_SetObject
PySys_SetPath=python39.PySys_SetPath
PySys_WriteStderr=python39.PySys_WriteStderr
PySys_WriteStdout=python39.PySys_WriteStdout
PyThreadState_Clear=python39.PyThreadState_Clear
PyThreadState_Delete=python39.PyThreadState_Delete
PyThreadState_DeleteCurrent=python39.PyThreadState_DeleteCurrent
PyThreadState_Get=python39.PyThreadState_Get
PyThreadState_GetDict=python39.PyThreadState_GetDict
PyThreadState_GetFrame=python39.PyThreadState_GetFrame
PyThreadState_GetID=python39.PyThreadState_GetID
PyThreadState_GetInterpreter=python39.PyThreadState_GetInterpreter
PyThreadState_New=python39.PyThreadState_New
PyThreadState_SetAsyncExc=python39.PyThreadState_SetAsyncExc
PyThreadState_Swap=python39.PyThreadState_Swap
PyThread_tss_alloc=python39.PyThread_tss_alloc
PyThread_tss_create=python39.PyThread_tss_create
PyThread_tss_delete=python39.PyThread_tss_delete
PyThread_tss_free=python39.PyThread_tss_free
PyThread_tss_get=python39.PyThread_tss_get
PyThread_tss_is_created=python39.PyThread_tss_is_created
PyThread_tss_set=python39.PyThread_tss_set
PyTraceBack_Here=python39.PyTraceBack_Here
PyTraceBack_Print=python39.PyTraceBack_Print
PyTraceBack_Type=python39.PyTraceBack_Type DATA
PyTupleIter_Type=python39.PyTupleIter_Type DATA
PyTuple_GetItem=python39.PyTuple_GetItem
PyTuple_GetSlice=python39.PyTuple_GetSlice
PyTuple_New=python39.PyTuple_New
PyTuple_Pack=python39.PyTuple_Pack
PyTuple_SetItem=python39.PyTuple_SetItem
PyTuple_Size=python39.PyTuple_Size
PyTuple_Type=python39.PyTuple_Type DATA
PyType_ClearCache=python39.PyType_ClearCache
PyType_FromSpec=python39.PyType_FromSpec
PyType_FromSpecWithBases=python39.PyType_FromSpecWithBases
PyType_GenericAlloc=python39.PyType_GenericAlloc
PyType_GenericNew=python39.PyType_GenericNew
PyType_GetFlags=python39.PyType_GetFlags
PyType_GetSlot=python39.PyType_GetSlot
PyType_IsSubtype=python39.PyType_IsSubtype
PyType_Modified=python39.PyType_Modified
PyType_Ready=python39.PyType_Ready
PyType_Type=python39.PyType_Type DATA
PyUnicodeDecodeError_Create=python39.PyUnicodeDecodeError_Create
PyUnicodeDecodeError_GetEncoding=python39.PyUnicodeDecodeError_GetEncoding
PyUnicodeDecodeError_GetEnd=python39.PyUnicodeDecodeError_GetEnd
PyUnicodeDecodeError_GetObject=python39.PyUnicodeDecodeError_GetObject
PyUnicodeDecodeError_GetReason=python39.PyUnicodeDecodeError_GetReason
PyUnicodeDecodeError_GetStart=python39.PyUnicodeDecodeError_GetStart
PyUnicodeDecodeError_SetEnd=python39.PyUnicodeDecodeError_SetEnd
PyUnicodeDecodeError_SetReason=python39.PyUnicodeDecodeError_SetReason
PyUnicodeDecodeError_SetStart=python39.PyUnicodeDecodeError_SetStart
PyUnicodeEncodeError_GetEncoding=python39.PyUnicodeEncodeError_GetEncoding
PyUnicodeEncodeError_GetEnd=python39.PyUnicodeEncodeError_GetEnd
PyUnicodeEncodeError_GetObject=python39.PyUnicodeEncodeError_GetObject
PyUnicodeEncodeError_GetReason=python39.PyUnicodeEncodeError_GetReason
PyUnicodeEncodeError_GetStart=python39.PyUnicodeEncodeError_GetStart
PyUnicodeEncodeError_SetEnd=python39.PyUnicodeEncodeError_SetEnd
PyUnicodeEncodeError_SetReason=python39.PyUnicodeEncodeError_SetReason
PyUnicodeEncodeError_SetStart=python39.PyUnicodeEncodeError_SetStart
PyUnicodeIter_Type=python39.PyUnicodeIter_Type DATA
PyUnicodeTranslateError_GetEnd=python39.PyUnicodeTranslateError_GetEnd
PyUnicodeTranslateError_GetObject=python39.PyUnicodeTranslateError_GetObject
PyUnicodeTranslateError_GetReason=python39.PyUnicodeTranslateError_GetReason
PyUnicodeTranslateError_GetStart=python39.PyUnicodeTranslateError_GetStart
PyUnicodeTranslateError_SetEnd=python39.PyUnicodeTranslateError_SetEnd
PyUnicodeTranslateError_SetReason=python39.PyUnicodeTranslateError_SetReason
PyUnicodeTranslateError_SetStart=python39.PyUnicodeTranslateError_SetStart
PyUnicode_Append=python39.PyUnicode_Append
PyUnicode_AppendAndDel=python39.PyUnicode_AppendAndDel
PyUnicode_AsASCIIString=python39.PyUnicode_AsASCIIString
PyUnicode_AsCharmapString=python39.PyUnicode_AsCharmapString
PyUnicode_AsDecodedObject=python39.PyUnicode_AsDecodedObject
PyUnicode_AsDecodedUnicode=python39.PyUnicode_AsDecodedUnicode
PyUnicode_AsEncodedObject=python39.PyUnicode_AsEncodedObject
PyUnicode_AsEncodedString=python39.PyUnicode_AsEncodedString
PyUnicode_AsEncodedUnicode=python39.PyUnicode_AsEncodedUnicode
PyUnicode_AsLatin1String=python39.PyUnicode_AsLatin1String
PyUnicode_AsMBCSString=python39.PyUnicode_AsMBCSString
PyUnicode_AsRawUnicodeEscapeString=python39.PyUnicode_AsRawUnicodeEscapeString
PyUnicode_AsUCS4=python39.PyUnicode_AsUCS4
PyUnicode_AsUCS4Copy=python39.PyUnicode_AsUCS4Copy
PyUnicode_AsUTF16String=python39.PyUnicode_AsUTF16String
PyUnicode_AsUTF32String=python39.PyUnicode_AsUTF32String
PyUnicode_AsUTF8String=python39.PyUnicode_AsUTF8String
PyUnicode_AsUnicodeEscapeString=python39.PyUnicode_AsUnicodeEscapeString
PyUnicode_AsWideChar=python39.PyUnicode_AsWideChar
PyUnicode_AsWideCharString=python39.PyUnicode_AsWideCharString
PyUnicode_BuildEncodingMap=python39.PyUnicode_BuildEncodingMap
PyUnicode_Compare=python39.PyUnicode_Compare
PyUnicode_CompareWithASCIIString=python39.PyUnicode_CompareWithASCIIString
PyUnicode_Concat=python39.PyUnicode_Concat
PyUnicode_Contains=python39.PyUnicode_Contains
PyUnicode_Count=python39.PyUnicode_Count
PyUnicode_Decode=python39.PyUnicode_Decode
PyUnicode_DecodeASCII=python39.PyUnicode_DecodeASCII
PyUnicode_DecodeCharmap=python39.PyUnicode_DecodeCharmap
PyUnicode_DecodeCodePageStateful=python39.PyUnicode_DecodeCodePageStateful
PyUnicode_DecodeFSDefault=python39.PyUnicode_DecodeFSDefault
PyUnicode_DecodeFSDefaultAndSize=python39.PyUnicode_DecodeFSDefaultAndSize
PyUnicode_DecodeLatin1=python39.PyUnicode_DecodeLatin1
PyUnicode_DecodeLocale=python39.PyUnicode_DecodeLocale
PyUnicode_DecodeLocaleAndSize=python39.PyUnicode_DecodeLocaleAndSize
PyUnicode_DecodeMBCS=python39.PyUnicode_DecodeMBCS
PyUnicode_DecodeMBCSStateful=python39.PyUnicode_DecodeMBCSStateful
PyUnicode_DecodeRawUnicodeEscape=python39.PyUnicode_DecodeRawUnicodeEscape
PyUnicode_DecodeUTF16=python39.PyUnicode_DecodeUTF16
PyUnicode_DecodeUTF16Stateful=python39.PyUnicode_DecodeUTF16Stateful
PyUnicode_DecodeUTF32=python39.PyUnicode_DecodeUTF32
PyUnicode_DecodeUTF32Stateful=python39.PyUnicode_DecodeUTF32Stateful
PyUnicode_DecodeUTF7=python39.PyUnicode_DecodeUTF7
PyUnicode_DecodeUTF7Stateful=python39.PyUnicode_DecodeUTF7Stateful
PyUnicode_DecodeUTF8=python39.PyUnicode_DecodeUTF8
PyUnicode_DecodeUTF8Stateful=python39.PyUnicode_DecodeUTF8Stateful
PyUnicode_DecodeUnicodeEscape=python39.PyUnicode_DecodeUnicodeEscape
PyUnicode_EncodeCodePage=python39.PyUnicode_EncodeCodePage
PyUnicode_EncodeFSDefault=python39.PyUnicode_EncodeFSDefault
PyUnicode_EncodeLocale=python39.PyUnicode_EncodeLocale
PyUnicode_FSConverter=python39.PyUnicode_FSConverter
PyUnicode_FSDecoder=python39.PyUnicode_FSDecoder
PyUnicode_Find=python39.PyUnicode_Find
PyUnicode_FindChar=python39.PyUnicode_FindChar
PyUnicode_Format=python39.PyUnicode_Format
PyUnicode_FromEncodedObject=python39.PyUnicode_FromEncodedObject
PyUnicode_FromFormat=python39.PyUnicode_FromFormat
PyUnicode_FromFormatV=python39.PyUnicode_FromFormatV
PyUnicode_FromObject=python39.PyUnicode_FromObject
PyUnicode_FromOrdinal=python39.PyUnicode_FromOrdinal
PyUnicode_FromString=python39.PyUnicode_FromString
PyUnicode_FromStringAndSize=python39.PyUnicode_FromStringAndSize
PyUnicode_FromWideChar=python39.PyUnicode_FromWideChar
PyUnicode_GetDefaultEncoding=python39.PyUnicode_GetDefaultEncoding
PyUnicode_GetLength=python39.PyUnicode_GetLength
PyUnicode_GetSize=python39.PyUnicode_GetSize
PyUnicode_InternFromString=python39.PyUnicode_InternFromString
PyUnicode_InternImmortal=python39.PyUnicode_InternImmortal
PyUnicode_InternInPlace=python39.PyUnicode_InternInPlace
PyUnicode_IsIdentifier=python39.PyUnicode_IsIdentifier
PyUnicode_Join=python39.PyUnicode_Join
PyUnicode_Partition=python39.PyUnicode_Partition
PyUnicode_RPartition=python39.PyUnicode_RPartition
PyUnicode_RSplit=python39.PyUnicode_RSplit
PyUnicode_ReadChar=python39.PyUnicode_ReadChar
PyUnicode_Replace=python39.PyUnicode_Replace
PyUnicode_Resize=python39.PyUnicode_Resize
PyUnicode_RichCompare=python39.PyUnicode_RichCompare
PyUnicode_Split=python39.PyUnicode_Split
PyUnicode_Splitlines=python39.PyUnicode_Splitlines
PyUnicode_Substring=python39.PyUnicode_Substring
PyUnicode_Tailmatch=python39.PyUnicode_Tailmatch
PyUnicode_Translate=python39.PyUnicode_Translate
PyUnicode_Type=python39.PyUnicode_Type DATA
PyUnicode_WriteChar=python39.PyUnicode_WriteChar
PyWeakref_GetObject=python39.PyWeakref_GetObject
PyWeakref_NewProxy=python39.PyWeakref_NewProxy
PyWeakref_NewRef=python39.PyWeakref_NewRef
PyWrapperDescr_Type=python39.PyWrapperDescr_Type DATA
PyWrapper_New=python39.PyWrapper_New
PyZip_Type=python39.PyZip_Type DATA
Py_AddPendingCall=python39.Py_AddPendingCall
Py_AtExit=python39.Py_AtExit
Py_BuildValue=python39.Py_BuildValue
Py_CompileString=python39.Py_CompileString
Py_DecRef=python39.Py_DecRef
Py_DecodeLocale=python39.Py_DecodeLocale
Py_EncodeLocale=python39.Py_EncodeLocale
Py_EndInterpreter=python39.Py_EndInterpreter
Py_EnterRecursiveCall=python39.Py_EnterRecursiveCall
Py_Exit=python39.Py_Exit
Py_FatalError=python39.Py_FatalError
Py_FileSystemDefaultEncodeErrors=python39.Py_FileSystemDefaultEncodeErrors DATA
Py_FileSystemDefaultEncoding=python39.Py_FileSystemDefaultEncoding DATA
Py_Finalize=python39.Py_Finalize
Py_FinalizeEx=python39.Py_FinalizeEx
Py_GenericAlias=python39.Py_GenericAlias
Py_GenericAliasType=python39.Py_GenericAliasType
Py_GetArgcArgv=python39.Py_GetArgcArgv
Py_GetBuildInfo=python39.Py_GetBuildInfo
Py_GetCompiler=python39.Py_GetCompiler
Py_GetCopyright=python39.Py_GetCopyright
Py_GetExecPrefix=python39.Py_GetExecPrefix
Py_GetPath=python39.Py_GetPath
Py_GetPlatform=python39.Py_GetPlatform
Py_GetPrefix=python39.Py_GetPrefix
Py_GetProgramFullPath=python39.Py_GetProgramFullPath
Py_GetProgramName=python39.Py_GetProgramName
Py_GetPythonHome=python39.Py_GetPythonHome
Py_GetRecursionLimit=python39.Py_GetRecursionLimit
Py_GetVersion=python39.Py_GetVersion
Py_HasFileSystemDefaultEncoding=python39.Py_HasFileSystemDefaultEncoding DATA
Py_IncRef=python39.Py_IncRef
Py_Initialize=python39.Py_Initialize
Py_InitializeEx=python39.Py_InitializeEx
Py_IsInitialized=python39.Py_IsInitialized
Py_LeaveRecursiveCall=python39.Py_LeaveRecursiveCall
Py_Main=python39.Py_Main
Py_MakePendingCalls=python39.Py_MakePendingCalls
Py_NewInterpreter=python39.Py_NewInterpreter
Py_ReprEnter=python39.Py_ReprEnter
Py_ReprLeave=python39.Py_ReprLeave
Py_SetPath=python39.Py_SetPath
Py_SetProgramName=python39.Py_SetProgramName
Py_SetPythonHome=python39.Py_SetPythonHome
Py_SetRecursionLimit=python39.Py_SetRecursionLimit
Py_SymtableString=python39.Py_SymtableString
Py_UTF8Mode=python39.Py_UTF8Mode DATA
Py_VaBuildValue=python39.Py_VaBuildValue
_PyArg_ParseTupleAndKeywords_SizeT=python39._PyArg_ParseTupleAndKeywords_SizeT
_PyArg_ParseTuple_SizeT=python39._PyArg_ParseTuple_SizeT
_PyArg_Parse_SizeT=python39._PyArg_Parse_SizeT
_PyArg_VaParseTupleAndKeywords_SizeT=python39._PyArg_VaParseTupleAndKeywords_SizeT
_PyArg_VaParse_SizeT=python39._PyArg_VaParse_SizeT
_PyErr_BadInternalCall=python39._PyErr_BadInternalCall
_PyObject_CallFunction_SizeT=python39._PyObject_CallFunction_SizeT
_PyObject_CallMethod_SizeT=python39._PyObject_CallMethod_SizeT
_PyObject_GC_Malloc=python39._PyObject_GC_Malloc
_PyObject_GC_New=python39._PyObject_GC_New
_PyObject_GC_NewVar=python39._PyObject_GC_NewVar
_PyObject_GC_Resize=python39._PyObject_GC_Resize
_PyObject_New=python39._PyObject_New
_PyObject_NewVar=python39._PyObject_NewVar
_PyState_AddModule=python39._PyState_AddModule
_PyThreadState_Init=python39._PyThreadState_Init
_PyThreadState_Prealloc=python39._PyThreadState_Prealloc
_PyTrash_delete_later=python39._PyTrash_delete_later DATA
_PyTrash_delete_nesting=python39._PyTrash_delete_nesting DATA
_PyTrash_deposit_object=python39._PyTrash_deposit_object
_PyTrash_destroy_chain=python39._PyTrash_destroy_chain
_PyTrash_thread_deposit_object=python39._PyTrash_thread_deposit_object
_PyTrash_thread_destroy_chain=python39._PyTrash_thread_destroy_chain
_PyWeakref_CallableProxyType=python39._PyWeakref_CallableProxyType DATA
_PyWeakref_ProxyType=python39._PyWeakref_ProxyType DATA
_PyWeakref_RefType=python39._PyWeakref_RefType DATA
_Py_BuildValue_SizeT=python39._Py_BuildValue_SizeT
_Py_CheckRecursionLimit=python39._Py_CheckRecursionLimit DATA
_Py_CheckRecursiveCall=python39._Py_CheckRecursiveCall
_Py_Dealloc=python39._Py_Dealloc
_Py_EllipsisObject=python39._Py_EllipsisObject DATA
_Py_FalseStruct=python39._Py_FalseStruct DATA
_Py_NoneStruct=python39._Py_NoneStruct DATA
_Py_NotImplementedStruct=python39._Py_NotImplementedStruct DATA
_Py_SwappedOp=python39._Py_SwappedOp DATA
_Py_TrueStruct=python39._Py_TrueStruct DATA
_Py_VaBuildValue_SizeT=python39._Py_VaBuildValue_SizeT

View File

@ -0,0 +1,9 @@
#include <windows.h>
BOOL WINAPI
DllMain(HINSTANCE hInstDLL,
DWORD fdwReason,
LPVOID lpReserved)
{
return TRUE;
}

View File

@ -0,0 +1,49 @@
// Resource script for Python console EXEs.
#include "python_ver_rc.h"
// Include the manifest file that indicates we support all
// current versions of Windows.
#include <winuser.h>
1 RT_MANIFEST "python.manifest"
1 ICON DISCARDABLE "icons\python.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION PYVERSION64
PRODUCTVERSION PYVERSION64
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", PYTHON_COMPANY "\0"
VALUE "FileDescription", "Python\0"
VALUE "FileVersion", PYTHON_VERSION
VALUE "InternalName", "Python Console\0"
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
VALUE "OriginalFilename", "python" PYTHON_DEBUG_EXT ".exe\0"
VALUE "ProductName", "Python\0"
VALUE "ProductVersion", PYTHON_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

View File

@ -0,0 +1,46 @@
// Resource script for Python core DLL.
#include "python_ver_rc.h"
// Include the manifest file that indicates we support all
// current versions of Windows.
#include <winuser.h>
2 RT_MANIFEST "python.manifest"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION PYVERSION64
PRODUCTVERSION PYVERSION64
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", PYTHON_COMPANY "\0"
VALUE "FileDescription", "Python Core\0"
VALUE "FileVersion", PYTHON_VERSION
VALUE "InternalName", "Python DLL\0"
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
VALUE "OriginalFilename", ORIGINAL_FILENAME "\0"
VALUE "ProductName", "Python\0"
VALUE "ProductVersion", PYTHON_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

View File

@ -0,0 +1,263 @@
/* Main program when embedded in a UWP application on Windows */
#include "Python.h"
#include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <shellapi.h>
#include <shlobj.h>
#include <string>
#include <winrt\Windows.ApplicationModel.h>
#include <winrt\Windows.Storage.h>
#ifdef PYTHONW
#ifdef _DEBUG
const wchar_t *PROGNAME = L"pythonw_d.exe";
#else
const wchar_t *PROGNAME = L"pythonw.exe";
#endif
#else
#ifdef _DEBUG
const wchar_t *PROGNAME = L"python_d.exe";
#else
const wchar_t *PROGNAME = L"python.exe";
#endif
#endif
static std::wstring
get_user_base()
{
try {
const auto appData = winrt::Windows::Storage::ApplicationData::Current();
if (appData) {
const auto localCache = appData.LocalCacheFolder();
if (localCache) {
auto path = localCache.Path();
if (!path.empty()) {
return std::wstring(path) + L"\\local-packages";
}
}
}
} catch (...) {
}
return std::wstring();
}
static std::wstring
get_package_family()
{
try {
const auto package = winrt::Windows::ApplicationModel::Package::Current();
if (package) {
const auto id = package.Id();
if (id) {
return std::wstring(id.FamilyName());
}
}
}
catch (...) {
}
return std::wstring();
}
static std::wstring
get_package_home()
{
try {
const auto package = winrt::Windows::ApplicationModel::Package::Current();
if (package) {
const auto path = package.InstalledLocation();
if (path) {
return std::wstring(path.Path());
}
}
}
catch (...) {
}
return std::wstring();
}
static PyStatus
set_process_name(PyConfig *config)
{
PyStatus status = PyStatus_Ok();
std::wstring executable;
const auto home = get_package_home();
const auto family = get_package_family();
if (!family.empty()) {
PWSTR localAppData;
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppData, 0,
NULL, &localAppData))) {
executable = std::wstring(localAppData)
+ L"\\Microsoft\\WindowsApps\\"
+ family
+ L"\\"
+ PROGNAME;
CoTaskMemFree(localAppData);
}
}
/* Only use module filename if we don't have a home */
if (home.empty() && executable.empty()) {
executable.resize(MAX_PATH);
while (true) {
DWORD len = GetModuleFileNameW(
NULL, executable.data(), (DWORD)executable.size());
if (len == 0) {
executable.clear();
break;
} else if (len == executable.size() &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
executable.resize(len * 2);
} else {
executable.resize(len);
break;
}
}
size_t i = executable.find_last_of(L"/\\");
if (i == std::wstring::npos) {
executable = PROGNAME;
} else {
executable.replace(i + 1, std::wstring::npos, PROGNAME);
}
}
if (!home.empty()) {
status = PyConfig_SetString(config, &config->home, home.c_str());
if (PyStatus_Exception(status)) {
return status;
}
}
const wchar_t *launcherPath = _wgetenv(L"__PYVENV_LAUNCHER__");
if (launcherPath) {
if (!executable.empty()) {
status = PyConfig_SetString(config, &config->base_executable,
executable.c_str());
if (PyStatus_Exception(status)) {
return status;
}
}
status = PyConfig_SetString(
config, &config->executable, launcherPath);
/* bpo-35873: Clear the environment variable to avoid it being
* inherited by child processes. */
_wputenv_s(L"__PYVENV_LAUNCHER__", L"");
} else if (!executable.empty()) {
status = PyConfig_SetString(
config, &config->executable, executable.c_str());
}
return status;
}
int
wmain(int argc, wchar_t **argv)
{
PyStatus status;
PyPreConfig preconfig;
PyConfig config;
const wchar_t *moduleName = NULL;
const wchar_t *p = wcsrchr(argv[0], L'\\');
if (!p) {
p = argv[0];
}
if (p) {
if (*p == L'\\') {
p++;
}
if (wcsnicmp(p, L"pip", 3) == 0) {
moduleName = L"pip";
} else if (wcsnicmp(p, L"idle", 4) == 0) {
moduleName = L"idlelib";
}
}
PyPreConfig_InitPythonConfig(&preconfig);
if (!moduleName) {
status = Py_PreInitializeFromArgs(&preconfig, argc, argv);
if (PyStatus_Exception(status)) {
goto fail_without_config;
}
}
PyConfig_InitPythonConfig(&config);
status = PyConfig_SetArgv(&config, argc, argv);
if (PyStatus_Exception(status)) {
goto fail;
}
if (moduleName) {
config.parse_argv = 0;
}
status = set_process_name(&config);
if (PyStatus_Exception(status)) {
goto fail;
}
p = _wgetenv(L"PYTHONUSERBASE");
if (!p || !*p) {
_wputenv_s(L"PYTHONUSERBASE", get_user_base().c_str());
}
if (moduleName) {
status = PyConfig_SetString(&config, &config.run_module, moduleName);
if (PyStatus_Exception(status)) {
goto fail;
}
status = PyConfig_SetString(&config, &config.run_filename, NULL);
if (PyStatus_Exception(status)) {
goto fail;
}
status = PyConfig_SetString(&config, &config.run_command, NULL);
if (PyStatus_Exception(status)) {
goto fail;
}
}
status = Py_InitializeFromConfig(&config);
if (PyStatus_Exception(status)) {
goto fail;
}
PyConfig_Clear(&config);
return Py_RunMain();
fail:
PyConfig_Clear(&config);
fail_without_config:
if (PyStatus_IsExit(status)) {
return status.exitcode;
}
assert(PyStatus_Exception(status));
Py_ExitStatusException(status);
/* Unreachable code */
return 0;
}
#ifdef PYTHONW
int WINAPI wWinMain(
HINSTANCE hInstance, /* handle to current instance */
HINSTANCE hPrevInstance, /* handle to previous instance */
LPWSTR lpCmdLine, /* pointer to command line */
int nCmdShow /* show state of window */
)
{
return wmain(__argc, __wargv);
}
#endif

View File

@ -0,0 +1,34 @@
// Resource script for Python core DLL.
// Currently only holds version information.
//
#pragma code_page(1252)
#include "winver.h"
#define PYTHON_COMPANY "Python Software Foundation"
#define PYTHON_COPYRIGHT "Copyright \xA9 2001-2021 Python Software Foundation. Copyright \xA9 2000 BeOpen.com. Copyright \xA9 1995-2001 CNRI. Copyright \xA9 1991-1995 SMC."
#define MS_WINDOWS
#include "modsupport.h"
#include "patchlevel.h"
#ifdef _DEBUG
# define PYTHON_DEBUG_EXT "_d"
#else
# define PYTHON_DEBUG_EXT
#endif
/* e.g., 3.3.0a1
* PY_VERSION comes from patchlevel.h
*/
#define PYTHON_VERSION PY_VERSION "\0"
/* 64-bit version number as comma-separated list of 4 16-bit ints */
#if PY_MICRO_VERSION > 64
# error "PY_MICRO_VERSION > 64"
#endif
#if PY_RELEASE_LEVEL > 99
# error "PY_RELEASE_LEVEL > 99"
#endif
#if PY_RELEASE_SERIAL > 9
# error "PY_RELEASE_SERIAL > 9"
#endif
#define PYVERSION64 PY_MAJOR_VERSION, PY_MINOR_VERSION, FIELD3, PYTHON_API_VERSION

View File

@ -0,0 +1,49 @@
// Resource script for Python console EXEs.
#include "python_ver_rc.h"
// Include the manifest file that indicates we support all
// current versions of Windows.
#include <winuser.h>
1 RT_MANIFEST "python.manifest"
1 ICON DISCARDABLE "icons\pythonw.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION PYVERSION64
PRODUCTVERSION PYVERSION64
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", PYTHON_COMPANY "\0"
VALUE "FileDescription", "Python\0"
VALUE "FileVersion", PYTHON_VERSION
VALUE "InternalName", "Python Application\0"
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
VALUE "OriginalFilename", "pythonw" PYTHON_DEBUG_EXT ".exe\0"
VALUE "ProductName", "Python\0"
VALUE "ProductVersion", PYTHON_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

View File

@ -0,0 +1,81 @@
Welcome to the "PC" subdirectory of the Python distribution
***********************************************************
This "PC" subdirectory contains complete project files to make
several older PC ports of Python, as well as all the PC-specific
Python source files. It should be located in the root of the
Python distribution, and there should be directories "Modules",
"Objects", "Python", etc. in the parent directory of this "PC"
subdirectory. Be sure to read the documentation in the Python
distribution.
Python requires library files such as string.py to be available in
one or more library directories. The search path of libraries is
set up when Python starts. To see the current Python library search
path, start Python and enter "import sys" and "print sys.path".
All PC ports use this scheme to try to set up a module search path:
1) The script location; the current directory without script.
2) The PYTHONPATH variable, if set.
3) For Win32 platforms (NT/95), paths specified in the Registry.
4) Default directories lib, lib/win, lib/test, lib/tkinter;
these are searched relative to the environment variable
PYTHONHOME, if set, or relative to the executable and its
ancestors, if a landmark file (Lib/string.py) is found ,
or the current directory (not useful).
5) The directory containing the executable.
The best installation strategy is to put the Python executable (and
DLL, for Win32 platforms) in some convenient directory such as
C:/python, and copy all library files and subdirectories (using XCOPY)
to C:/python/lib. Then you don't need to set PYTHONPATH. Otherwise,
set the environment variable PYTHONPATH to your Python search path.
For example,
set PYTHONPATH=.;d:\python\lib;d:\python\lib\win;d:\python\lib\dos-8x3
There are several add-in modules to build Python programs which use
the native Windows operating environment. The ports here just make
"QuickWin" and DOS Python versions which support a character-mode
(console) environment. Look in www.python.org for Tkinter, PythonWin,
WPY and wxPython.
To make a Python port, start the Integrated Development Environment
(IDE) of your compiler, and read in the native "project file"
(or makefile) provided. This will enable you to change any source
files or build settings so you can make custom builds.
pyconfig.h An important configuration file specific to PC's.
config.c The list of C modules to include in the Python PC
version. Manually edit this file to add or
remove Python modules.
testpy.py A Python test program. Run this to test your
Python port. It should produce copious output,
ending in a report on how many tests were OK, how many
failed, and how many were skipped. Don't worry about
skipped tests (these test unavailable optional features).
Additional files and subdirectories for 32-bit Windows
======================================================
python_nt.rc Resource compiler input for python15.dll.
dl_nt.c
Additional sources used for 32-bit Windows features.
getpathp.c Default sys.path calculations (for all PC platforms).
dllbase_nt.txt A (manually maintained) list of base addresses for
various DLLs, to avoid run-time relocation.
Note for Windows 3.x and DOS users
==================================
Neither Windows 3.x nor DOS is supported any more. The last Python
version that supported these was Python 1.5.2; the support files were
present in Python 2.0 but weren't updated, and it is not our intention
to support these platforms for Python 2.x.

View File

@ -0,0 +1,49 @@
// Resource script for Sqlite DLL.
#include <winver.h>
// Include the manifest file that indicates we support all
// current versions of Windows.
#include <winuser.h>
2 RT_MANIFEST "python.manifest"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#define _S(x) #x
#define S(x) _S(x)
VS_VERSION_INFO VERSIONINFO
FILEVERSION SQLITE_MAJOR_VERSION, SQLITE_MINOR_VERSION, SQLITE_MICRO_VERSION, SQLITE_PATCH_VERSION
PRODUCTVERSION SQLITE_MAJOR_VERSION, SQLITE_MINOR_VERSION, SQLITE_MICRO_VERSION, SQLITE_PATCH_VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", "SQLite3\0"
VALUE "FileDescription", "SQLite3\0"
VALUE "FileVersion", S(SQLITE_VERSION) "\0"
VALUE "InternalName", "SQLite3 DLL\0"
VALUE "LegalCopyright", "Unspecified\0"
VALUE "OriginalFilename", "sqlite3.dll\0"
VALUE "ProductName", "SQLite3\0"
VALUE "ProductVersion", S(SQLITE_VERSION) "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

View File

@ -0,0 +1,156 @@
# Overview
NOTE: This file requires more content.
Since Python 3.7.2, releases have been made through the Microsoft Store
to allow easy installation on Windows 10.0.17763.0 and later.
# Building
To build the store package, the PC/layout script should be used.
Execute the directory with the build of Python to package, and pass
"-h" for full command-line options.
To sideload test builds, you will need a local certificate.
Instructions are available at
https://docs.microsoft.com/windows/uwp/packaging/create-certificate-package-signing.
After exporting your certificate, you will need the subject name and
SHA256 hash. The `certutil -dump <cert file>` command will display this
information.
To build for sideloading, use these commands in PowerShell:
```
$env:APPX_DATA_PUBLISHER=<your certificate subject name>
$env:APPX_DATA_SHA256=<your certificate SHA256>
$env:SigningCertificateFile=<your certificate file>
python PC/layout --copy <layout directory> --include-appxmanifest
Tools/msi/make_appx.ps1 <layout directory> python.msix -sign
Add-AppxPackage python.msix
```
(Note that only the last command requires PowerShell, and the others
can be used from Command Prompt. You can also double-click to install
the final package.)
To build for publishing to the Store, use these commands:
```
$env:APPX_DATA_PUBLISHER = $null
$env:APPX_DATA_SHA256 = $null
python PC/layout --copy <layout directory> --preset-appxmanifest --precompile
Tools/msi/make_appx.ps1 <layout directory> python.msix
```
Note that this package cannot be installed locally. It may only be
added to a submission for the store.
# Submission Metadata
This file contains the text that we use to fill out the store listing
for the Microsoft Store. It needs to be entered manually when creating
a new submission via the dashboard at
https://partner.microsoft.com/dashboard.
We keep it here for convenience and to allow it to be updated via pull
requests.
When submitting a new app, the HeadlessAppBypass waiver will be needed.
To request this, send an email to PartnerOps@microsoft.com with the app
ID (12 character token available from the dashboard). The waiver needs
to be applied *before* uploading the package (as of November 2019).
Ensure that the new app is named "Python.3.X", where X is the minor
version of the release. If the name provided initially does not match
the name used when building the package, the upload will fail. The
display name shown to users can be set later.
## Title
Python 3.9
## Short Title
Python
## Description
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Pythons elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.
The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.
## ShortDescription
The Python 3.9 interpreter and runtime.
## Copyright Trademark Information
(c) Python Software Foundation
## Additional License Terms
Visit https://docs.python.org/3.9/license.html for latest license terms.
PSF LICENSE AGREEMENT FOR PYTHON 3.9
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and
the Individual or Organization ("Licensee") accessing and otherwise using Python
3.9 software in source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python 3.9 alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
copyright, i.e., "Copyright © 2001-2018 Python Software Foundation; All Rights
Reserved" are retained in Python 3.9 alone or in any derivative version
prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or
incorporates Python 3.9 or any part thereof, and wants to make the
derivative work available to others as provided herein, then Licensee hereby
agrees to include in any such work a brief summary of the changes made to Python
3.9.
4. PSF is making Python 3.9 available to Licensee on an "AS IS" basis.
PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF
EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
USE OF PYTHON 3.9 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 3.9
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 3.9, OR ANY DERIVATIVE
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach of
its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship
of agency, partnership, or joint venture between PSF and Licensee. This License
Agreement does not grant permission to use PSF trademarks or trade name in a
trademark sense to endorse or promote products or services of Licensee, or any
third party.
8. By copying, installing or otherwise using Python 3.9, Licensee agrees
to be bound by the terms and conditions of this License Agreement.
## Features
* Easy to install Python runtime
* Supported by core CPython team
* Find Python, Pip and Idle on PATH
## Search Terms
* Python
* Scripting
* Interpreter

View File

@ -0,0 +1,30 @@
import sys
# This is a test module for Python. It looks in the standard
# places for various *.py files. If these are moved, you must
# change this module too.
try:
import os
except:
print("""Could not import the standard "os" module.
Please check your PYTHONPATH environment variable.""")
sys.exit(1)
try:
import symbol
except:
print("""Could not import the standard "symbol" module. If this is
a PC, you should add the dos_8x3 directory to your PYTHONPATH.""")
sys.exit(1)
for dir in sys.path:
file = os.path.join(dir, "os.py")
if os.path.isfile(file):
test = os.path.join(dir, "test")
if os.path.isdir(test):
# Add the "test" directory to PYTHONPATH.
sys.path = sys.path + [test]
import libregrtest # Standard Python tester.
libregrtest.main()

View File

@ -0,0 +1,89 @@
'''
This script gets the version number from ucrtbased.dll and checks
whether it is a version with a known issue.
'''
import sys
from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,
Structure, WinDLL)
from ctypes.wintypes import DWORD, HANDLE
class VS_FIXEDFILEINFO(Structure):
_fields_ = [
("dwSignature", DWORD),
("dwStrucVersion", DWORD),
("dwFileVersionMS", DWORD),
("dwFileVersionLS", DWORD),
("dwProductVersionMS", DWORD),
("dwProductVersionLS", DWORD),
("dwFileFlagsMask", DWORD),
("dwFileFlags", DWORD),
("dwFileOS", DWORD),
("dwFileType", DWORD),
("dwFileSubtype", DWORD),
("dwFileDateMS", DWORD),
("dwFileDateLS", DWORD),
]
kernel32 = WinDLL('kernel32')
version = WinDLL('version')
if len(sys.argv) < 2:
print('Usage: validate_ucrtbase.py <ucrtbase|ucrtbased>')
sys.exit(2)
try:
ucrtbased = WinDLL(sys.argv[1])
except OSError:
print('Cannot find ucrtbased.dll')
# This likely means that VS is not installed, but that is an
# obvious enough problem if you're trying to produce a debug
# build that we don't need to fail here.
sys.exit(0)
# We will immediately double the length up to MAX_PATH, but the
# path may be longer, so we retry until the returned string is
# shorter than our buffer.
name_len = actual_len = 130
while actual_len == name_len:
name_len *= 2
name = create_unicode_buffer(name_len)
actual_len = kernel32.GetModuleFileNameW(HANDLE(ucrtbased._handle),
name, len(name))
if not actual_len:
print('Failed to get full module name.')
sys.exit(2)
size = version.GetFileVersionInfoSizeW(name, None)
if not size:
print('Failed to get size of version info.')
sys.exit(2)
ver_block = c_buffer(size)
if (not version.GetFileVersionInfoW(name, None, size, ver_block) or
not ver_block):
print('Failed to get version info.')
sys.exit(2)
pvi = POINTER(VS_FIXEDFILEINFO)()
if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())):
print('Failed to get version value from info.')
sys.exit(2)
ver = (
pvi.contents.dwProductVersionMS >> 16,
pvi.contents.dwProductVersionMS & 0xFFFF,
pvi.contents.dwProductVersionLS >> 16,
pvi.contents.dwProductVersionLS & 0xFFFF,
)
print('{} is version {}.{}.{}.{}'.format(name.value, *ver))
if ver < (10, 0, 10586):
print('WARN: ucrtbased contains known issues. '
'Please update the Windows 10 SDK.')
print('See:')
print(' http://bugs.python.org/issue27705')
print(' https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk')
sys.exit(1)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,250 @@
/* Author: Toby Dickenson <htrd90@zepler.org>
*
* Copyright (c) 1999 Toby Dickenson
*
* Permission to use this software in any way is granted without
* fee, provided that the copyright notice above appears in all
* copies. This software is provided "as is" without any warranty.
*/
/* Modified by Guido van Rossum */
/* Beep added by Mark Hammond */
/* Win9X Beep and platform identification added by Uncle Timmy */
/* Example:
import winsound
import time
# Play wav file
winsound.PlaySound('c:/windows/media/Chord.wav', winsound.SND_FILENAME)
# Play sound from control panel settings
winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS)
# Play wav file from memory
data=open('c:/windows/media/Chimes.wav',"rb").read()
winsound.PlaySound(data, winsound.SND_MEMORY)
# Start playing the first bit of wav file asynchronously
winsound.PlaySound('c:/windows/media/Chord.wav',
winsound.SND_FILENAME|winsound.SND_ASYNC)
# But don't let it go for too long...
time.sleep(0.1)
# ...Before stopping it
winsound.PlaySound(None, 0)
*/
#include <Python.h>
#include <windows.h>
#include <mmsystem.h>
PyDoc_STRVAR(sound_module_doc,
"PlaySound(sound, flags) - play a sound\n"
"SND_FILENAME - sound is a wav file name\n"
"SND_ALIAS - sound is a registry sound association name\n"
"SND_LOOP - Play the sound repeatedly; must also specify SND_ASYNC\n"
"SND_MEMORY - sound is a memory image of a wav file\n"
"SND_PURGE - stop all instances of the specified sound\n"
"SND_ASYNC - PlaySound returns immediately\n"
"SND_NODEFAULT - Do not play a default beep if the sound can not be found\n"
"SND_NOSTOP - Do not interrupt any sounds currently playing\n" // Raising RuntimeError if needed
"SND_NOWAIT - Return immediately if the sound driver is busy\n" // Without any errors
"\n"
"Beep(frequency, duration) - Make a beep through the PC speaker.\n"
"MessageBeep(type) - Call Windows MessageBeep.");
/*[clinic input]
module winsound
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=a18401142d97b8d5]*/
#include "clinic/winsound.c.h"
/*[clinic input]
winsound.PlaySound
sound: object
The sound to play; a filename, data, or None.
flags: int
Flag values, ored together. See module documentation.
A wrapper around the Windows PlaySound API.
[clinic start generated code]*/
static PyObject *
winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags)
/*[clinic end generated code: output=49a0fd16a372ebeb input=c63e1f2d848da2f2]*/
{
int ok;
wchar_t *wsound;
Py_buffer view = {NULL, NULL};
if (sound == Py_None) {
wsound = NULL;
} else if (flags & SND_MEMORY) {
if (flags & SND_ASYNC) {
/* Sidestep reference counting headache; unfortunately this also
prevent SND_LOOP from memory. */
PyErr_SetString(PyExc_RuntimeError,
"Cannot play asynchronously from memory");
return NULL;
}
if (PyObject_GetBuffer(sound, &view, PyBUF_SIMPLE) < 0) {
return NULL;
}
wsound = (wchar_t *)view.buf;
} else {
if (!PyUnicode_Check(sound)) {
PyErr_Format(PyExc_TypeError,
"'sound' must be str or None, not '%s'",
Py_TYPE(sound)->tp_name);
return NULL;
}
wsound = PyUnicode_AsWideCharString(sound, NULL);
if (wsound == NULL) {
return NULL;
}
}
Py_BEGIN_ALLOW_THREADS
ok = PlaySoundW(wsound, NULL, flags);
Py_END_ALLOW_THREADS
if (view.obj) {
PyBuffer_Release(&view);
} else if (sound != Py_None) {
PyMem_Free(wsound);
}
if (!ok) {
PyErr_SetString(PyExc_RuntimeError, "Failed to play sound");
return NULL;
}
Py_RETURN_NONE;
}
/*[clinic input]
winsound.Beep
frequency: int
Frequency of the sound in hertz.
Must be in the range 37 through 32,767.
duration: int
How long the sound should play, in milliseconds.
A wrapper around the Windows Beep API.
[clinic start generated code]*/
static PyObject *
winsound_Beep_impl(PyObject *module, int frequency, int duration)
/*[clinic end generated code: output=f32382e52ee9b2fb input=40e360cfa00a5cf0]*/
{
BOOL ok;
if (frequency < 37 || frequency > 32767) {
PyErr_SetString(PyExc_ValueError,
"frequency must be in 37 thru 32767");
return NULL;
}
Py_BEGIN_ALLOW_THREADS
ok = Beep(frequency, duration);
Py_END_ALLOW_THREADS
if (!ok) {
PyErr_SetString(PyExc_RuntimeError,"Failed to beep");
return NULL;
}
Py_RETURN_NONE;
}
/*[clinic input]
winsound.MessageBeep
type: int(c_default="MB_OK") = MB_OK
Call Windows MessageBeep(x).
x defaults to MB_OK.
[clinic start generated code]*/
static PyObject *
winsound_MessageBeep_impl(PyObject *module, int type)
/*[clinic end generated code: output=120875455121121f input=db185f741ae21401]*/
{
BOOL ok;
Py_BEGIN_ALLOW_THREADS
ok = MessageBeep(type);
Py_END_ALLOW_THREADS
if (!ok) {
PyErr_SetExcFromWindowsErr(PyExc_RuntimeError, 0);
return NULL;
}
Py_RETURN_NONE;
}
static struct PyMethodDef sound_methods[] =
{
WINSOUND_PLAYSOUND_METHODDEF
WINSOUND_BEEP_METHODDEF
WINSOUND_MESSAGEBEEP_METHODDEF
{NULL, NULL}
};
static void
add_define(PyObject *dict, const char *key, long value)
{
PyObject *k = PyUnicode_FromString(key);
PyObject *v = PyLong_FromLong(value);
if (v && k) {
PyDict_SetItem(dict, k, v);
}
Py_XDECREF(k);
Py_XDECREF(v);
}
#define ADD_DEFINE(tok) add_define(dict,#tok,tok)
static struct PyModuleDef winsoundmodule = {
PyModuleDef_HEAD_INIT,
"winsound",
sound_module_doc,
-1,
sound_methods,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC
PyInit_winsound(void)
{
PyObject *dict;
PyObject *module = PyModule_Create(&winsoundmodule);
if (module == NULL)
return NULL;
dict = PyModule_GetDict(module);
ADD_DEFINE(SND_ASYNC);
ADD_DEFINE(SND_NODEFAULT);
ADD_DEFINE(SND_NOSTOP);
ADD_DEFINE(SND_NOWAIT);
ADD_DEFINE(SND_ALIAS);
ADD_DEFINE(SND_FILENAME);
ADD_DEFINE(SND_MEMORY);
ADD_DEFINE(SND_PURGE);
ADD_DEFINE(SND_LOOP);
ADD_DEFINE(SND_APPLICATION);
ADD_DEFINE(MB_OK);
ADD_DEFINE(MB_ICONASTERISK);
ADD_DEFINE(MB_ICONEXCLAMATION);
ADD_DEFINE(MB_ICONHAND);
ADD_DEFINE(MB_ICONQUESTION);
return module;
}