distlib-0.3.8/0000775000175000017500000000000014536003571013460 5ustar vinayvinay00000000000000distlib-0.3.8/PC/0000775000175000017500000000000014536003571013762 5ustar vinayvinay00000000000000distlib-0.3.8/PC/CLISimpleLauncher.vcxproj0000644000175000017500000002710613555545620020654 0ustar vinayvinay00000000000000 Debug Win32 Debug x64 Release Win32 Release x64 {A0AB4387-243A-48F7-881D-DE138DDE68BA} SimpleLauncher Win32Proj Application MultiByte true Application MultiByte Application MultiByte true Application MultiByte <_ProjectFileVersion>10.0.40219.1 $(SolutionDir)$(Configuration)\ $(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)dist\ $(Configuration)\ false $(SolutionDir)dist\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset t64 t32 Link Link Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreaded Default Level3 EditAndContinue true true $(OutDir)$(ProjectName).map true Console MachineX86 python make_test.py test\test.exe $(OutDir)$(TargetName)$(TargetExt) make_test.py X64 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreaded Level3 ProgramDatabase true true $(OutDir)$(ProjectName).map true Console MachineX64 python make_test.py test\test.exe $(OutDir)$(TargetName)$(TargetExt) make_test.py MinSpace true Size WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded true Level3 ProgramDatabase dist\t32.exe true true $(OutDir)$(ProjectName).map true Console true true MachineX86 X64 MinSpace true Size WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded true Level3 ProgramDatabase dist\t64.exe true true $(OutDir)$(ProjectName).map true Console true true MachineX64 distlib-0.3.8/PC/launcher.c0000664000175000017500000010112214273421414015722 0ustar vinayvinay00000000000000/* * Copyright (C) 2011-2022 Vinay Sajip. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. #endif #include #include #include #include #include #pragma comment (lib, "Shlwapi.lib") #define APPENDED_ARCHIVE #define USE_ENVIRONMENT #define SUPPORT_RELATIVE_PATH #define MSGSIZE 1024 #if !defined(APPENDED_ARCHIVE) static wchar_t suffix[] = { #if defined(_CONSOLE) L"-script.py" #else L"-script.pyw" #endif }; #endif #if defined(SUPPORT_RELATIVE_PATH) #define RELATIVE_PREFIX L"\\" #define RELATIVE_PREFIX_LENGTH 15 #endif #if !defined(_CONSOLE) typedef int (__stdcall *MSGBOXWAPIA)(IN HWND hWnd, IN LPCSTR lpText, IN LPCSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds); typedef int (__stdcall *MSGBOXWAPIW)(IN HWND hWnd, IN LPWSTR lpText, IN LPWSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds); #define MB_TIMEDOUT 32000 int MessageBoxTimeoutA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, WORD wLanguageId, DWORD dwMilliseconds) { static MSGBOXWAPIA MsgBoxTOA = NULL; HMODULE hUser = LoadLibraryA("user32.dll"); if (!MsgBoxTOA) { if (hUser) MsgBoxTOA = (MSGBOXWAPIA)GetProcAddress(hUser, "MessageBoxTimeoutA"); else { /* * stuff happened, add code to handle it here * (possibly just call MessageBox()) */ } } if (MsgBoxTOA) return MsgBoxTOA(hWnd, lpText, lpCaption, uType, wLanguageId, dwMilliseconds); if (hUser) FreeLibrary(hUser); return 0; } int MessageBoxTimeoutW(HWND hWnd, LPWSTR lpText, LPWSTR lpCaption, UINT uType, WORD wLanguageId, DWORD dwMilliseconds) { static MSGBOXWAPIW MsgBoxTOW = NULL; HMODULE hUser = LoadLibraryA("user32.dll"); if (!MsgBoxTOW) { if (hUser) MsgBoxTOW = (MSGBOXWAPIW)GetProcAddress(hUser, "MessageBoxTimeoutW"); else { /* * stuff happened, add code to handle it here * (possibly just call MessageBox()) */ } } if (MsgBoxTOW) return MsgBoxTOW(hWnd, lpText, lpCaption, uType, wLanguageId, dwMilliseconds); if (hUser) FreeLibrary(hUser); return 0; } #endif static void wassert(BOOL condition, wchar_t * format, ... ) { if (!condition) { va_list va; wchar_t message[MSGSIZE]; int len; va_start(va, format); len = _vsnwprintf_s(message, MSGSIZE, MSGSIZE - 1, format, va); #if defined(_CONSOLE) fwprintf(stderr, L"Fatal error in launcher: %s\n", message); #else MessageBoxTimeoutW(NULL, message, L"Fatal Error in Launcher", MB_OK | MB_SETFOREGROUND | MB_ICONERROR, 0, 3000); #endif ExitProcess(1); } } static void assert(BOOL condition, char * format, ... ) { if (!condition) { va_list va; char message[MSGSIZE]; int len; va_start(va, format); len = vsnprintf_s(message, MSGSIZE, MSGSIZE - 1, format, va); #if defined(_CONSOLE) fprintf(stderr, "Fatal error in launcher: %s\n", message); #else MessageBoxTimeoutA(NULL, message, "Fatal Error in Launcher", MB_OK | MB_SETFOREGROUND | MB_ICONERROR, 0, 3000); #endif ExitProcess(1); } } static wchar_t script_path[MAX_PATH]; #if defined(APPENDED_ARCHIVE) #define LARGE_BUFSIZE (65 * 1024 * 1024) typedef struct { DWORD sig; DWORD unused_disk_nos; DWORD unused_numrecs; DWORD cdsize; DWORD cdoffset; } ENDCDR; /* We don't want to pick up this variable when scanning the executable. * So we initialise it statically, but fill in the first byte later. */ static char end_cdr_sig [4] = { 0x00, 0x4B, 0x05, 0x06 }; static char * find_pattern(char *buffer, size_t bufsize, char * pattern, size_t patsize) { char * result = NULL; char * p; char * bp = buffer; size_t n; while ((n = bufsize - (bp - buffer) - patsize) >= 0) { p = (char *) memchr(bp, pattern[0], n); if (p == NULL) break; if (memcmp(pattern, p, patsize) == 0) { result = p; /* keep trying - we want the last one */ } bp = p + 1; } return result; } static char * find_shebang(char * buffer, size_t bufsize) { FILE * fp = NULL; errno_t rc; char * result = NULL; char * p; size_t read; long pos; __int64 file_size; __int64 end_cdr_offset = -1; ENDCDR end_cdr; rc = _wfopen_s(&fp, script_path, L"rb"); assert(rc == 0, "Failed to open executable"); fseek(fp, 0, SEEK_END); file_size = ftell(fp); pos = (long) (file_size - bufsize); if (pos < 0) pos = 0; fseek(fp, pos, SEEK_SET); read = fread(buffer, sizeof(char), bufsize, fp); p = find_pattern(buffer, read, end_cdr_sig, sizeof(end_cdr_sig)); if (p != NULL) { end_cdr = *((ENDCDR *) p); end_cdr_offset = pos + (p - buffer); } else { /* * Try a larger buffer. A comment can only be 64K long, so * go for the largest size. */ char * big_buffer = malloc(LARGE_BUFSIZE); int n = (int) LARGE_BUFSIZE; pos = (long) (file_size - n); if (pos < 0) pos = 0; fseek(fp, pos, SEEK_SET); read = fread(big_buffer, sizeof(char), n, fp); p = find_pattern(big_buffer, read, end_cdr_sig, sizeof(end_cdr_sig)); assert(p != NULL, "Unable to find an appended archive."); end_cdr = *((ENDCDR *) p); end_cdr_offset = pos + (p - big_buffer); free(big_buffer); } end_cdr_offset -= end_cdr.cdsize + end_cdr.cdoffset; /* * end_cdr_offset should now be pointing to the start of the archive. * However, the "start of the archive" is a little ill-defined, as * not all means of prepending data to a zipfile handle the central * directory offset the same way (simple file content appends leave * it alone, obviously, but the stdlib zipapp and zipfile modules * reflect the prepended data in the offset). * We consider two possibilities here: * 1. end_cdr_offset points to the start of the shebang (zipapp) * 2. end_cdr_offset points to the end of the shebang (data copy) * We'll assume the shebang line has no # or ! chars except at the * beginning, and fits into bufsize (which should be MAX_PATH). */ /* Check for case 1 - we are at the start of the shebang */ fseek(fp, (long) end_cdr_offset, SEEK_SET); read = fread(buffer, sizeof(char), bufsize, fp); assert(read > 0, "Unable to read from file"); if (memcmp(buffer, "#!", 2) == 0) { result = buffer; } else { /* We are not at the start, so check backward bufsize bytes */ pos = (long) (end_cdr_offset - bufsize); if (pos < 0) pos = 0; fseek(fp, pos, SEEK_SET); read = fread(buffer, sizeof(char), bufsize, fp); assert(read > 0, "Unable to read from file"); p = &buffer[read - 1]; while (p >= buffer) { if (memcmp(p, "#!", 2) == 0) { result = p; break; } --p; } } fclose(fp); return result; } #endif #if defined(USE_ENVIRONMENT) /* * Where to place any executable found on the path. Should be OK to use a * static as there's only one of these per invocation of this executable. */ static wchar_t path_executable[MSGSIZE]; static BOOL find_on_path(wchar_t * name) { wchar_t * pathext; size_t varsize; wchar_t * context = NULL; wchar_t * extension; DWORD len; errno_t rc; BOOL found = FALSE; if (wcschr(name, L'.') != NULL) { /* assume it has an extension. */ if (SearchPathW(NULL, name, NULL, MSGSIZE, path_executable, NULL)) found = TRUE; } else { /* No extension - search using registered extensions. */ rc = _wdupenv_s(&pathext, &varsize, L"PATHEXT"); _wcslwr_s(pathext, varsize); if (rc == 0) { extension = wcstok_s(pathext, L";", &context); while (extension) { len = SearchPathW(NULL, name, extension, MSGSIZE, path_executable, NULL); if (len) { found = TRUE; break; } extension = wcstok_s(NULL, L";", &context); } free(pathext); } } return found; } /* * Find an executable in the environment. For now, we just look in the path, * but potentially we could expand this to look in the registry, etc. */ static wchar_t * find_environment_executable(wchar_t * line) { BOOL found = find_on_path(line); return found ? path_executable : NULL; } #endif static wchar_t * skip_ws(wchar_t *p) { while (*p && iswspace(*p)) ++p; return p; } static wchar_t * skip_me(wchar_t * p) { wchar_t * result; wchar_t terminator; if (*p != L'\"') terminator = L' '; else { terminator = *p++; ++p; } result = wcschr(p, terminator); if (result == NULL) /* perhaps nothing more on the command line */ result = L""; else result = skip_ws(++result); return result; } static char * find_terminator(char *buffer, size_t size) { char c; char * result = NULL; char * end = buffer + size; char * p; for (p = buffer; p < end; p++) { c = *p; if (c == '\r') { result = p; break; } if (c == '\n') { result = p; break; } } return result; } #if defined(DUPLICATE_HANDLES) static BOOL safe_duplicate_handle(HANDLE in, HANDLE * pout) { BOOL ok; HANDLE process = GetCurrentProcess(); #if defined(_CONSOLE) DWORD rc; #endif *pout = NULL; /* * See https://github.com/pypa/pip/issues/10444 - for the GUI launcher, * errors are returned by DuplicateHandle. There may be no good reason * why a GUI process would want to use these handles, but for now we * attempt duplication but ignore errors in the GUI case. */ ok = DuplicateHandle(process, in, process, pout, 0, TRUE, DUPLICATE_SAME_ACCESS); #if defined(_CONSOLE) if (!ok) { rc = GetLastError(); if (rc == ERROR_INVALID_HANDLE) ok = TRUE; } return ok; #else return TRUE; #endif } #endif /* * These items are global so that thet can be accessed * from the Ctrl-C handler or other auxiliary routine. */ static PROCESS_INFORMATION child_process_info; static JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info; static HANDLE job; static BOOL control_key_handler(DWORD type) { /* * See https://github.com/pypa/pip/issues/10444 */ #if defined(OLD_LOGIC) if ((type == CTRL_C_EVENT) || (type == CTRL_BREAK_EVENT)) { return TRUE; } WaitForSingleObject(child_process_info.hProcess, INFINITE); #else switch (type) { case CTRL_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: /* * Allow the child to outlive the launcher, to carry out any * cleanup for a graceful exit. It will either exit or get * terminated by the session server. */ if (job != NULL) { job_info.BasicLimitInformation.LimitFlags &= ~JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; SetInformationJobObject( job, JobObjectExtendedLimitInformation, &job_info, sizeof(job_info)); } } #endif return TRUE; } #if !defined(_CONSOLE) /* * End the launcher's "app starting" cursor state. * * When Explorer launches a Windows (GUI) application, it displays * the "app starting" (the "pointer + hourglass") cursor for a number * of seconds, or until the app does something UI-ish (eg, creating a * window, or fetching a message). As this launcher doesn't do this * directly, that cursor remains even after the child process does these * things. We avoid that by doing the stuff in here. * See http://bugs.python.org/issue17290 and * https://github.com/pypa/pip/issues/10444#issuecomment-973408601 */ static void clear_app_starting_state() { MSG msg; HWND hwnd; PostMessageW(0, 0, 0, 0); GetMessageW(&msg, 0, 0, 0); /* Proxy the child's input idle event. */ WaitForInputIdle(child_process_info.hProcess, INFINITE); /* * Signal the process input idle event by creating a window and pumping * sent messages. The window class isn't important, so just use the * system "STATIC" class. */ hwnd = CreateWindowExW(0, L"STATIC", L"PyLauncher", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); /* Process all sent messages and signal input idle. */ PeekMessageW(&msg, hwnd, 0, 0, 0); DestroyWindow(hwnd); } #endif /* * See https://github.com/pypa/pip/issues/10444#issuecomment-1055392299 */ static BOOL make_handle_inheritable(HANDLE handle) { DWORD file_type = GetFileType(handle); // Ignore an invalid handle, non-file object type, unsupported file type, // or a console file prior to Windows 8. if (file_type == FILE_TYPE_UNKNOWN || (file_type == FILE_TYPE_CHAR && ((ULONG_PTR)handle & 3))) { return TRUE; } return SetHandleInformation(handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); } 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 ) { } /* * Best-effort cleanup of any C file descriptors that were inherited * from the parent process. This cleans up all fds except 0-2. */ static void cleanup_fds(WORD cbReserved2, LPBYTE lpReserved2) { int handle_count = 0; UNALIGNED HANDLE* first_handle = NULL; UNALIGNED HANDLE* current_handle = NULL; _invalid_parameter_handler old_handler = NULL; // The structure is: , , if (cbReserved2 < sizeof(int) || NULL == lpReserved2) { return; } handle_count = *(UNALIGNED int*)lpReserved2; // Verify the buffer is large enough if (cbReserved2 < sizeof(int) + handle_count + sizeof(HANDLE) * handle_count) { return; } first_handle = (UNALIGNED HANDLE *)(lpReserved2 + sizeof(int) + handle_count); old_handler = _set_invalid_parameter_handler(&silent_invalid_parameter_handler); { // Close all fds inherited from the parent, except for the standard I/O fds. // We'll deal with those later. for (current_handle = first_handle + 3; current_handle < first_handle + handle_count; ++current_handle) { // Ignore invalid handles, as that means this fd was not inherited. // -2 is a special value (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-170) // that we check for just in case. if (NULL == *current_handle || INVALID_HANDLE_VALUE == *current_handle || (HANDLE)-2 == *current_handle) { continue; } _close((int)(current_handle - first_handle)); } } _set_invalid_parameter_handler(old_handler); } /* * Returns the HANDLE associated with a FILE* object, or INVALID_HANDLE_VALUE * on error. */ static HANDLE get_stream_handle(FILE * stream) { _invalid_parameter_handler old_handler = NULL; int fd = -1; HANDLE handle = INVALID_HANDLE_VALUE; old_handler = _set_invalid_parameter_handler(&silent_invalid_parameter_handler); { fd = _fileno(stream); if (fd >= 0) { handle = (HANDLE)_get_osfhandle(fd); } else { handle = INVALID_HANDLE_VALUE; } } _set_invalid_parameter_handler(old_handler); return handle; } /* * Closes the Windows standard I/O handles (GetStdHandle) * in a best-effort manner. Ensures that the stderr stream is left untouched. */ static void cleanup_standard_io(void) { HANDLE stdin_handle = INVALID_HANDLE_VALUE; HANDLE stdout_handle = INVALID_HANDLE_VALUE; HANDLE stderr_handle = INVALID_HANDLE_VALUE; HANDLE hStdIn = INVALID_HANDLE_VALUE; HANDLE hStdOut = INVALID_HANDLE_VALUE; HANDLE hStdErr = INVALID_HANDLE_VALUE; // We need to close both the C streams stdin and stdout, // and the Windows standard I/O handles. However, these may be equal, // so care must be taken not to close a handle twice. Moreover, // handles for several C streams may be equal as well. // Fun all around. // Get the handles associated with the standard I/O streams. stdin_handle = get_stream_handle(stdin); stdout_handle = get_stream_handle(stdout); stderr_handle = get_stream_handle(stderr); // If any two underlying handles are equal, drop everything and return. // There's bound to be trouble if we continue with closing the streams. if (((INVALID_HANDLE_VALUE != stdin_handle) && (stdin_handle == stdout_handle || stdin_handle == stderr_handle)) || ((INVALID_HANDLE_VALUE != stdout_handle) && (stdout_handle == stdin_handle || stdout_handle == stderr_handle)) || ((INVALID_HANDLE_VALUE != stderr_handle) && (stderr_handle == stdin_handle || stderr_handle == stdout_handle))) { return; } // Get the Windows I/O handles before we do anything. hStdIn = GetStdHandle(STD_INPUT_HANDLE); hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); hStdErr = GetStdHandle(STD_ERROR_HANDLE); // At this point, we have confirmed that the I/O streams all have different // handles, and we have the Windows standard I/O handles as well. // Proceed with closing the streams. fclose(stdin); fclose(stdout); // Now we need to close the Windows standard I/O handles, as they might // differ from the handles for the C streams. // First, make sure we don't close handles that we have already closed // by closing the streams. if (stdin_handle == hStdIn || stdout_handle == hStdIn) { SetStdHandle(STD_INPUT_HANDLE, NULL); hStdIn = NULL; } if (stdin_handle == hStdOut || stdout_handle == hStdOut) { SetStdHandle(STD_OUTPUT_HANDLE, NULL); hStdOut = NULL; } if (stdin_handle == hStdErr || stdout_handle == hStdErr) { SetStdHandle(STD_ERROR_HANDLE, NULL); hStdErr = NULL; } // Ensure we don't accidentally close the standard error handle. if (stderr_handle == hStdIn) { hStdIn = NULL; } if (stderr_handle == hStdOut) { hStdOut = NULL; } if (stderr_handle == hStdErr) { hStdErr = NULL; } // Close 'em. if (NULL != hStdIn && INVALID_HANDLE_VALUE != hStdIn) { CloseHandle(hStdIn); SetStdHandle(STD_INPUT_HANDLE, NULL); } if (NULL != hStdOut && INVALID_HANDLE_VALUE != hStdOut) { CloseHandle(hStdOut); SetStdHandle(STD_OUTPUT_HANDLE, NULL); } if (NULL != hStdErr && INVALID_HANDLE_VALUE != hStdErr) { CloseHandle(hStdErr); SetStdHandle(STD_ERROR_HANDLE, NULL); } } #define SWITCH_WORKING_DIR #if defined(SWITCH_WORKING_DIR) /* * Switch the working directory to the user's temp directory. */ static void switch_working_directory() { WCHAR tempDir[MAX_PATH + 1]; DWORD len = GetTempPathW(MAX_PATH + 1, tempDir); if (len > 0 && len <= MAX_PATH) { SetCurrentDirectoryW(tempDir); } } #endif /* * Best-effort cleanup of file descriptors and handles after spawning the child * process. * See discussion starting from here: https://github.com/pypa/pip/issues/10444#issuecomment-1055392299 */ static void post_spawn_cleanup(WORD cbReserved2, LPBYTE lpReserved2) { cleanup_fds(cbReserved2, lpReserved2); cleanup_standard_io(); #if defined(SWITCH_WORKING_DIR) switch_working_directory(); #endif } /* * See https://github.com/pypa/pip/issues/10444#issuecomment-971921420 */ #define STARTF_UNDOC_MONITOR 0x400 /* * See https://github.com/pypa/pip/issues/10444#issuecomment-973396812 */ static void run_child(wchar_t * cmdline) { DWORD rc; BOOL ok; STARTUPINFOW si; job = CreateJobObject(NULL, NULL); assert(job != NULL, "Job creation failed"); ok = QueryInformationJobObject(job, JobObjectExtendedLimitInformation, &job_info, sizeof(job_info), &rc); assert(ok && (rc == sizeof(job_info)), "Job information querying failed"); job_info.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK; ok = SetInformationJobObject(job, JobObjectExtendedLimitInformation, &job_info, sizeof(job_info)); assert(ok, "Job information setting failed"); memset(&si, 0, sizeof(si)); GetStartupInfoW(&si); /* * See https://github.com/pypa/pip/issues/10444#issuecomment-973396812 */ if ((si.dwFlags & (STARTF_USEHOTKEY | STARTF_UNDOC_MONITOR)) == 0) { HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE); HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE hErr = GetStdHandle(STD_ERROR_HANDLE); #if defined(DUPLICATE_HANDLES) ok = safe_duplicate_handle(hIn, &si.hStdInput); assert(ok, "stdin duplication failed"); CloseHandle(hIn); ok = safe_duplicate_handle(hOut, &si.hStdOutput); assert(ok, "stdout duplication failed"); CloseHandle(hOut); /* We might need stderr late, so don't close it but mark as non-inheritable */ SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, 0); ok = safe_duplicate_handle(hErr, &si.hStdError); assert(ok, "stderr duplication failed"); #else /* * See https://github.com/pypa/pip/issues/10444#issuecomment-1055392299 */ ok = make_handle_inheritable(hIn); assert(ok, "making stdin inheritable failed"); ok = make_handle_inheritable(hOut); assert(ok, "making stdout inheritable failed"); ok = make_handle_inheritable(hErr); assert(ok, "making stderr inheritable failed"); si.hStdInput = hIn; si.hStdOutput = hOut; si.hStdError = hErr; #endif si.dwFlags |= STARTF_USESTDHANDLES; } ok = CreateProcessW(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &child_process_info); if (!ok) { // Failed to create process. See if we can find out why. DWORD err = GetLastError(); wchar_t emessage[MSGSIZE]; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), emessage, MSGSIZE, NULL); wassert(ok, L"Unable to create process using '%ls': %ls", cmdline, emessage); } // Assign the process to the job straight away. See https://github.com/pypa/distlib/issues/175 AssignProcessToJobObject(job, child_process_info.hProcess); post_spawn_cleanup(si.cbReserved2, si.lpReserved2); /* * Control handler setting is now done after process creation because the handler needs access * to the child_process_info structure, which is populated by the CreateProcessW call above. */ ok = SetConsoleCtrlHandler((PHANDLER_ROUTINE) control_key_handler, TRUE); assert(ok, "control handler setting failed"); #if !defined(_CONSOLE) clear_app_starting_state(&child_process_info); #endif CloseHandle(child_process_info.hThread); WaitForSingleObjectEx(child_process_info.hProcess, INFINITE, FALSE); ok = GetExitCodeProcess(child_process_info.hProcess, &rc); assert(ok, "Failed to get exit code of process"); ExitProcess(rc); } static wchar_t * find_exe_extension(wchar_t * line) { wchar_t * p; while ((p = StrStrIW(line, L".exe")) != NULL) { wchar_t c = p[4]; if ((c == L'\0') || (c == L'"') || iswspace(c)) break; line = &p[4]; } return p; } static wchar_t * find_executable_and_args(wchar_t * line, wchar_t ** argp) { wchar_t * p = find_exe_extension(line); #if defined(USE_ENVIRONMENT) wchar_t * q; int n; #endif wchar_t * result; #if !defined(USE_ENVIRONMENT) assert(p != NULL, "Expected to find a command ending in '.exe' in shebang line: %ls", line); p += 4; /* skip past the '.exe' */ result = line; #else if (p != NULL) { p += 4; /* skip past the '.exe' */ result = line; } else { n = _wcsnicmp(line, L"/usr/bin/env", 12); assert(n == 0, "Expected to find a command ending in '.exe' in shebang line: %ls", line); p = line + 12; /* past the '/usr/bin/env' */ assert(*p && iswspace(*p), "Expected to find whitespace after '/usr/bin/env': %ls", line); do { ++p; } while (*p && iswspace(*p)); /* Now, p points to what comes after /usr/bin/env and any following whitespace. */ q = p; /* Skip past executable name and NUL-terminate it. */ while (*q && !iswspace(*q)) ++q; if (iswspace(*q)) *q++ = L'\0'; result = find_environment_executable(p); assert(result != NULL, "Unable to find executable in environment: %ls", line); p = q; /* point past name of executable in shebang */ } #endif if (*line == L'"') { assert(*p == L'"', "Expected terminating double-quote for executable in shebang line: %ls", line); *p++ = L'\0'; ++line; ++result; /* See https://bitbucket.org/pypa/distlib/issues/104 */ } /* p points just past the executable. It must either be a NUL or whitespace. */ #if !defined(SUPPORT_RELATIVE_PATH) assert(*p != L'"', "Terminating quote without starting quote for executable in shebang line: %ls", line); #else if (_wcsnicmp(line, RELATIVE_PREFIX, RELATIVE_PREFIX_LENGTH) && (line[RELATIVE_PREFIX_LENGTH] != L'\"')) { assert(*p != L'"', "Terminating quote without starting quote for executable in shebang line: %ls", line); } #endif /* if p is whitespace, make it NUL to truncate 'line', and advance */ if (*p && iswspace(*p)) *p++ = L'\0'; /* Now we can skip the whitespace, having checked that it's there. */ while(*p && iswspace(*p)) ++p; *argp = p; return result; } static int process(int argc, char * argv[]) { wchar_t * cmdline = skip_me(GetCommandLineW()); wchar_t * psp; size_t len = GetModuleFileNameW(NULL, script_path, MAX_PATH); FILE *fp = NULL; char buffer[MAX_PATH]; wchar_t wbuffer[MAX_PATH]; #if defined(SUPPORT_RELATIVE_PATH) wchar_t dbuffer[MAX_PATH]; wchar_t pbuffer[MAX_PATH]; wchar_t * qp; int prefix_offset; #endif char *cp; wchar_t * wcp; wchar_t * cmdp; char * p; wchar_t * wp; int n; #if !defined(APPENDED_ARCHIVE) errno_t rc; #endif if (script_path[0] != L'\"') psp = script_path; else { psp = &script_path[1]; len -= 2; } psp[len] = L'\0'; #if !defined(APPENDED_ARCHIVE) /* Replace the .exe with -script.py(w) */ wp = wcsstr(psp, L".exe"); assert(wp != NULL, "Failed to find \".exe\" in executable name"); len = MAX_PATH - (wp - script_path); assert(len > sizeof(suffix), "Failed to append \"%ls\" suffix", suffix); wcsncpy_s(wp, len, suffix, sizeof(suffix)); #endif #if defined(APPENDED_ARCHIVE) /* Initialise signature dynamically so that it doesn't appear in * a stock executable. */ end_cdr_sig[0] = 0x50; p = find_shebang(buffer, MAX_PATH); assert(p != NULL, "Failed to find shebang"); #else rc = _wfopen_s(&fp, psp, L"rb"); assert(rc == 0, "Failed to open script file '%ls'", psp); fread(buffer, sizeof(char), MAX_PATH, fp); fclose(fp); p = buffer; #endif cp = find_terminator(p, MAX_PATH); assert(cp != NULL, "Expected to find terminator in shebang line"); *cp = '\0'; // Decode as UTF-8 n = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, p, (int) (cp - p), wbuffer, MAX_PATH); assert(n != 0, "Expected to decode shebang line using UTF-8"); wbuffer[n] = L'\0'; wcp = wbuffer; while (*wcp && iswspace(*wcp)) ++wcp; assert(*wcp == L'#', "Expected to find \'#\' at start of shebang line"); ++wcp; while (*wcp && iswspace(*wcp)) ++wcp; assert(*wcp == L'!', "Expected to find \'!\' following \'#\' in shebang line"); ++wcp; while (*wcp && iswspace(*wcp)) ++wcp; wp = NULL; wcp = find_executable_and_args(wcp, &wp); assert(wcp != NULL, "Expected to find executable in shebang line"); assert(wp != NULL, "Expected to find arguments (even if empty) in shebang line"); #if defined(SUPPORT_RELATIVE_PATH) /* If the executable starts with the relative prefix, resolve the following path relative to the launcher's directory. */ prefix_offset = RELATIVE_PREFIX_LENGTH; if (!_wcsnicmp(RELATIVE_PREFIX, wcp, prefix_offset)) { wcscpy_s(dbuffer, MAX_PATH, script_path); PathRemoveFileSpecW(dbuffer); if (wcp[prefix_offset] == L'\"') { prefix_offset++; qp = wcschr(&wcp[prefix_offset], L'\"'); assert(qp != NULL, "Expected terminating double-quote for executable in shebang line: %ls", wcp); *qp = L'\0'; } // The following call appears to canonicalize the path, so no need to // worry about doing that PathCombineW(pbuffer, dbuffer, &wcp[prefix_offset]); wcp = pbuffer; } #endif /* 3 spaces + 4 quotes + NUL */ len = wcslen(wcp) + wcslen(wp) + 8 + wcslen(psp) + wcslen(cmdline); cmdp = (wchar_t *) calloc(len, sizeof(wchar_t)); assert(cmdp != NULL, "Expected to be able to allocate command line memory"); _snwprintf_s(cmdp, len, len, L"\"%ls\" %ls \"%ls\" %ls", wcp, wp, psp, cmdline); run_child(cmdp); /* never actually returns */ free(cmdp); return 0; } #if defined(_CONSOLE) int main(int argc, char* argv[]) { return process(argc, argv); } #else int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return process(__argc, __argv); } #endif distlib-0.3.8/PC/ReadMe.txt0000644000175000017500000000373413453041443015662 0ustar vinayvinay00000000000000This is a simple launcher for Python files, which is functionally equivalent to the launchers in setuptools but not based on setuptools code. There are two versions of the launcher - console and GUI - built from the same source code. The launcher has been written as part of the pythonv branch, and is intended to facilitate location of the correct Python executable for a script in an environment where there may be multiple versions of Python deployed. The launcher is intended to facilitate script execution under Windows where a PEP 397-compatible launcher is not available. The idea is that each Python script has a copy of the launcher (symlinks not being generally available under Windows). For scripts to work with the launcher, they have to have a name ending in -script.py (for a console script) or -script.pyw (for a GUI script). The deployment system (e.g. packaging) will ensure that for foo-script.py, a console launcher opy named foo.exe is placed in the same directory; for bar-script.pyw, a GUI launcher copy named bar.exe is placed in the same directory. Assuming that the relevant directories are on the path, the scripts can be invoked using just "foo" or "bar". The foo.exe or bar.exe executable then runs: it looks for a script with the appropriate suffix ("-script.py" or "-script.pyw") in the same directory, and if found, opens that script to read a shebang line indicating which Python executable to use for the script. That executable, if found, is launched with the script and other arguments passed: foo a b c -> c:\path\to\python.exe c:\other\path\to\foo-script.py a b c bar d e f -> c:\path\to\pythonw.exe c:\other\path\to\bar-script.pyw d e f Note: More recently, the launchers have been updated to find their script in an archive appended to the executable, rather than a separate file. (This variant is enabled when APPENDED_ARCHIVE is #defined). This allows the launchers to be used to e.g. run .pyz archives as native Windows executables. distlib-0.3.8/PC/GUISimpleLauncher.vcxproj0000644000175000017500000002535713555545620020677 0ustar vinayvinay00000000000000 Debug Win32 Debug x64 Release Win32 Release x64 {6295B87B-6312-4D7D-BCE9-A3626FD25417} GUISimpleLauncher Win32Proj Application MultiByte true Application MultiByte Application MultiByte true Application MultiByte <_ProjectFileVersion>10.0.40219.1 $(SolutionDir)$(Configuration)\ $(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)dist\ $(Configuration)\ false $(SolutionDir)dist\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset w32 w64 Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreaded Level3 EditAndContinue true true $(OutDir)$(ProjectName).map true Windows MachineX86 X64 Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreaded Level3 ProgramDatabase true true $(OutDir)$(ProjectName).map true Windows MachineX64 MinSpace true Size WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreaded true Level3 ProgramDatabase dist\w32.exe true true $(OutDir)$(ProjectName).map true Windows true true MachineX86 X64 MinSpace true Size WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreaded true Level3 ProgramDatabase dist\w64.exe true true $(OutDir)$(ProjectName).map true Windows true true MachineX64 distlib-0.3.8/PC/launcher.ico0000644000175000017500000004651613453041443016266 0ustar vinayvinay00000000000000 v(^ h. 00 %  >8 hH( @...GGGWWWiiiuuu ̀ ww ww||wwwwwwwwfwwwww|fwwwwwwffwwwwwwffwwwwwfflwwffffffwfffffflwffffffwffffff|ffffffffR\Ilffl)ffح2L18Ϥ"A< ΣTπU  ؀ ???????( 444MMMSSSzzzp p{p{ffkof_fffk_fff[f}UUUfL4UUU_kJqO_~'[U_Uwwwww{~( @%%%+++000===AAAIIIMMMQQQVVVYYY]]]~dFgggjjjmmmrrruuu}}}u?z=~;gEkCoAr@:IbpƏKУk(,1?5<\CKQsU[cbð/Pp  =1[Qyq/"P0p=LYgx1Qq&/@PZpt1Qq/&PAp[tϩ1Qq/P"p0>M[iy1Qqұ/Pp  >1\Qzq/Pp!+6@IZ1pQq/ P6pLbx1Qq,/KPip1Qq/-P?pRcv1Qqϑܱ/Pp!&,>X1qQq_______CCBABADL*(%$""&GABJIIDDJC??AD_-(''%$GG#_DIJIIJIIIDIJDD_+)(''%GG _JMCEJ?ABAECA?BA_,+)('%%"!_IM@AJACDCIDI____.,++>________JMJJJJJJJJJF_..,+)('%$"! #GIMCEJJJI?J__...,+(('%$"! &_JM?AJJJJCJ__...,+)(''%$" _IMJJJJJJJJ_K=...,++(''%$! _JMCDJJJJAJ_K_______L*%$"!_I_?AMNJJEJ_ L'%$"_I_MMMMMMJJ_ _('%%_I_CEMIJJMEM _(''*_I_?BMDJEMDMF _)(-LI_MMMCMMMMM_________< ____I_CEM1;MACDMEJM__I_?A_D1@IJJMJMM_FF_I__6_@/EMMMNMM_FF_I_C80EJDMJCJFF?:AA20?_M_MIEM______MIC4BC/ N______MMMMJIDAI_9/ HJJMMJMMMJ??BAI_A7503 IJMMCBCBA44CCI___BAO;6___C_MJIDIDMI_CI___O; @__C_C?J?AJI_?A_DJJI@ O_CM?;I?JI_________H9MAIJJIJI_CD_____JJI73C;IJIJI_?AMDJJDIMJIE5:JIJI__________MMIA:IJJJJJJJJJJJJJJJJMJ???( 444MMMRRRYYY~eGuuu}}}x>iErCE~7?HVbx/!P7pLcyϏ1Qq/Pp",6@J[1qQq/Pp  =1[Qyq/"P0p=LYgx1Qq&/@PZpt1Qq/&PAp[tϩ1Qq/P"p0>M[iy1Qqұ/Pp  >1\Qzq/Pp!+6@IZ1pQq/ P6pLbx1Qq,/KPip1Qq/-P?pRcv1Qqϑܱ/Pp!&,>X1qQq!%///* !*/"(%%'%/) /!#''////+/+"*(/ / !%(/ ( (*/ (///) */   )*  /"///// /+/// # + !%//  +"*+'#+//+'!%*++$++!+! !!!<(0`  !!$& &"   WܱNj+<<:5pi$!!!4888&SNJFB=950,(%%%5ǎVRNIEѹ|Jq?o@ZUQMID@<73/+&"-Ɍ444"ք̴wq?]YUPLHC?;72.*%!"""4888&dya\XTPKGC>:61-)% OÑ%%%5ʎA{;ys`\WSOJFB>951,($(9|:z;xq?o@mAkBiCgCdDuZ;73.*Ǒ%%%5̎È>89}:{;yq?o@mAjBhCfD~dEuZ?:625Оa789}:{;yr>p?n@lAjBhCfD}dEB>:5^ό555"܄ѳ„7789}:{;xr?p@n@lAjBgCeDFA=9"""4;;;&ŌC89~9|:z;xr?p@mAkAiBgCIELɑQQQJnnn~~~Įq?o@mAkBiCHHH"""vvv9~:{;yq?o@mAkB:::'''___sssttt8Ϧuǣvyp?n@lA888T---6fffnddd%%%"""OOOSSSċDҧuʤv{;yr?p?xM<<r?̷999VVV###)))444ѳ͝b@~9|:z;}Cg˶Ӎ󑑑ZZZlll;;;!!!""")))___&&&2:::ppp{{{___WWWWWW:::!!!"""***www"""4888&,̑999ԖJJJ|||lll:::"""BBBXXX|||$$$6,uuuKKKCCC@@@...www* Ҍ666"KKKaaaLLLWWW@$"""4;;;&nnnfff!!!$$$999444]ttt|ȇɑ&&&5ЎvvvmmmVVV{{{OOOڥaaaCCCpppό555"ބ|||MMMfff"""4;;;&\\\Ǒ%%%5Ύݧܦ͌555"ۄۥ"""4:::&ڤÑ%%%5ˎܤׇ ww?ww??ww?ww?ww?ww?ww?ww?ww?ww?ww?ww?wwwwwwwwwwwwwwwwwwwwwwwwwwww?ww?ww?ww?ww?ww?ww?ww?ww?ww?ww?wwwwwwwwwwwwwwww?wwwwwwww( @ !!!0\\\JeeeQ666D555A0$ vH<602\7qڴvvvj&&&D1"gLF@;5?кVQKE?9(aV[UPJD>82-uuun{{{j`ZTOVo@lAb_YSMGB<60+%<aVmt>q?n@bb^XRLFA;5/)$Ywwwn}}}j~Cv=s>p?bba]WQKE@:4.(+{;xbba[VPJD?93-'aV~:{;xr?o@lAiBfD}dE|cE|cEiB<61?9}:z;w=t>q?n@kAiCfD}cE|cE}dFGA;=aVңi89|:yq?n@kBhCeD|cE|cELF@mzzznjʓP8~9{;yp?mAjBgCeD|cEPJ\¯mAjBgC~dEaV}:z;xq?n@lAiCJJJőPyq?n@~YVVV???wwwiiiΡkA|;y>>3@@@y~~~obbb000kkk@@@---U<<<&&&[[[6uuusssWWWIII$$$&&&qqqlllg|||s4bbbhhhƑUUU000QQQ}}}---{bbb(iiiLLLBBBaVggg+++NNN|||nj]]]tttkkkrrrwwwӦaVӦzzznjӦˉ ?????(  C﫫oIਨS=?_QF4aZмoEcaXMB70~Iq?c`VK@58z;u=qv>3Eyn@iB~dE}dFGHYYYuuuġ=xmAhC}dE}eGS444|||gC}cEMMM~>q?kAiGRRR¢Gu=xKʺ~AAAAAAAAAAAAAAAAdistlib-0.3.8/PC/SimpleLauncher.sln0000644000175000017500000000375213555545620017426 0ustar vinayvinay00000000000000 Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CLISimpleLauncher", "CLISimpleLauncher.vcxproj", "{A0AB4387-243A-48F7-881D-DE138DDE68BA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUISimpleLauncher", "GUISimpleLauncher.vcxproj", "{6295B87B-6312-4D7D-BCE9-A3626FD25417}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Debug|Win32.ActiveCfg = Debug|Win32 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Debug|Win32.Build.0 = Debug|Win32 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Debug|x64.ActiveCfg = Debug|x64 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Debug|x64.Build.0 = Debug|x64 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Release|Win32.ActiveCfg = Release|Win32 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Release|Win32.Build.0 = Release|Win32 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Release|x64.ActiveCfg = Release|x64 {A0AB4387-243A-48F7-881D-DE138DDE68BA}.Release|x64.Build.0 = Release|x64 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Debug|Win32.ActiveCfg = Debug|Win32 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Debug|Win32.Build.0 = Debug|Win32 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Debug|x64.ActiveCfg = Debug|x64 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Debug|x64.Build.0 = Debug|x64 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Release|Win32.ActiveCfg = Release|Win32 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Release|Win32.Build.0 = Release|Win32 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Release|x64.ActiveCfg = Release|x64 {6295B87B-6312-4D7D-BCE9-A3626FD25417}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal distlib-0.3.8/PC/launcher.rc0000644000175000017500000000012413453041443016101 0ustar vinayvinay00000000000000#define IDI_ICON 101 LANGUAGE 0, 0 IDI_ICON ICON ".\\launcher.ico" distlib-0.3.8/CONTRIBUTORS.txt0000644000175000017500000000315513453041443016155 0ustar vinayvinay00000000000000======================= Distutils2 Contributors ======================= The Distutils2 project was started by Tarek Ziadé and is currently maintained by Éric Araujo. Many people have contributed to the project. distlib has started off using some of the code from distutil2. If you're making a patch, please add your name below in alphabetical order, and welcome into the Fellowship of the Packaging! Thanks to: - Rajiv Abraham - Ali Afshar - David Barnett - Pior Bastida - Anthony Baxter - Erik Bray - C. Titus Brown - Francisco Martín Brugué - Nicolas Cadou - Godefroid Chapelle - Julien Courteau - Christophe Combelles - Jason R. Coombs - Pierre-Yves David - Ned Deily - Konrad Delong - Josip Djolonga - John Edmonds - André Espaze - Boris Feld - Andrew Francis - Hallvard B Furuseth - Patrice Gauthier - Yannick Gingras - Filip Gruszczyński - Walker Hale IV - Alexandre Hamelin - Kelsey Hightower - Thomas Holmes - Preston Holmes - Christian Hudon - Julien Jehannet - Jeremy Kloth - Thomas Kluyver - Amos Latteier - Mathieu Leduc-Hamel - Pierre Paul Lefebvre - Tshepang Lekhonkhobe - Alain Leufroy - Janusz Lewandowski - Martin von Löwis - Hugo Lopes Tavares - Guillermo López-Anglada - Justin Love - Simon Mathieu - Carl Meyer - Alexis Métaireau - Julien Miotte - Zubin Mithra - Derek McTavish Mounce - Paul Moore - Michael Mulich - Louis Munro - Gaël Pasgrimaud - George Peristerakis - Mathieu Perreault - Guillaume Pratte - Sean Reifschneider - Antoine Reversat - Arc Riley - C. Anthony Risinger - Elson Rodriguez - Luis Rojas - Erik Rose - Brian Rosner - Vinay Sajip - Victor Stinner - Alexandre Vassalotti - Nadeem Vawda distlib-0.3.8/distlib.egg-info/0000775000175000017500000000000014536003571016604 5ustar vinayvinay00000000000000distlib-0.3.8/distlib.egg-info/SOURCES.txt0000664000175000017500000001274714536003571020503 0ustar vinayvinay00000000000000CHANGES.rst CONTRIBUTORS.txt LICENSE.txt MANIFEST.in README.rst pyproject.toml setup.cfg tox.ini PC/CLISimpleLauncher.vcxproj PC/GUISimpleLauncher.vcxproj PC/ReadMe.txt PC/SimpleLauncher.sln PC/launcher.c PC/launcher.ico PC/launcher.rc distlib/__init__.py distlib/compat.py distlib/database.py distlib/index.py distlib/locators.py distlib/manifest.py distlib/markers.py distlib/metadata.py distlib/resources.py distlib/scripts.py distlib/t32.exe distlib/t64-arm.exe distlib/t64.exe distlib/util.py distlib/version.py distlib/w32.exe distlib/w64-arm.exe distlib/w64.exe distlib/wheel.py distlib.egg-info/PKG-INFO distlib.egg-info/SOURCES.txt distlib.egg-info/dependency_links.txt distlib.egg-info/top_level.txt tests/LONG_DESC.txt tests/PKG-INFO tests/SETUPTOOLS-PKG-INFO tests/SETUPTOOLS-PKG-INFO2 tests/bad.bin tests/bad.tar tests/bad.tar.bz2 tests/bad.tar.gz tests/bad.zip tests/bar.zip tests/compat.py tests/distlib_tests.py tests/dummy-0.1-py27-none-any.whl tests/evil.tar.gz tests/foo.zip tests/good.bin tests/good.bin.asc tests/good.tar tests/good.tar.bz2 tests/good.tar.gz tests/good.zip tests/included.json tests/keycert.pem tests/minimext-0.1-cp27-none-linux_x86_64.whl tests/minimext-0.1-cp32-cp32mu-linux_x86_64.whl tests/minimext-0.1-cp33-cp33m-linux_x86_64.whl tests/pydist.json tests/support.py tests/test_all.py tests/test_database.py tests/test_index.py tests/test_locators.py tests/test_manifest.py tests/test_markers.py tests/test_metadata.py tests/test_resources.py tests/test_scripts.py tests/test_testdist-0.1.zip tests/test_util.py tests/test_version.py tests/test_wheel.py tests/valid_wheel-0.0.1-py3-none-any.whl tests/bad_wheels/dummy-0.1-py27-none-any.whl tests/fake_archives/coverage-3.3.1.tar.gz tests/fake_archives/coverage-3.4b2.tar.gz tests/fake_archives/coverage-3.5.2.tar.gz tests/fake_archives/subdir/config-0.3.7-py27-none-any.whl tests/fake_archives/subdir/python-gnupg-0.2.9.tar.gz tests/fake_archives/subdir/subsubdir/Django-1.4.1.tar.gz tests/fake_archives/subdir/subsubdir/Flask-0.9.tar.gz tests/fake_dists/babar.cfg tests/fake_dists/babar.png tests/fake_dists/cheese-2.0.2.egg-info tests/fake_dists/nut-funkyversion.egg-info tests/fake_dists/strawberry-0.6.egg tests/fake_dists/truffles-5.0.egg-info tests/fake_dists/babar-0.1.dist-info/INSTALLER tests/fake_dists/babar-0.1.dist-info/METADATA tests/fake_dists/babar-0.1.dist-info/RECORD tests/fake_dists/babar-0.1.dist-info/REQUESTED tests/fake_dists/babar-0.1.dist-info/RESOURCES tests/fake_dists/babar-0.1.dist-info/pydist-exports.json tests/fake_dists/babar-0.1.dist-info/pydist.json tests/fake_dists/bacon-0.1.egg-info/PKG-INFO tests/fake_dists/bacon-0.1.egg-info/installed-files.txt tests/fake_dists/banana-0.4.egg/EGG-INFO/PKG-INFO tests/fake_dists/banana-0.4.egg/EGG-INFO/SOURCES.txt tests/fake_dists/banana-0.4.egg/EGG-INFO/dependency_links.txt tests/fake_dists/banana-0.4.egg/EGG-INFO/entry_points.txt tests/fake_dists/banana-0.4.egg/EGG-INFO/not-zip-safe tests/fake_dists/banana-0.4.egg/EGG-INFO/requires.txt tests/fake_dists/banana-0.4.egg/EGG-INFO/top_level.txt tests/fake_dists/choxie-2.0.0.9/truffles.py tests/fake_dists/choxie-2.0.0.9.dist-info/INSTALLER tests/fake_dists/choxie-2.0.0.9.dist-info/METADATA tests/fake_dists/choxie-2.0.0.9.dist-info/RECORD tests/fake_dists/choxie-2.0.0.9.dist-info/REQUESTED tests/fake_dists/choxie-2.0.0.9.dist-info/pydist-exports.json tests/fake_dists/choxie-2.0.0.9.dist-info/pydist.json tests/fake_dists/choxie-2.0.0.9/choxie/__init__.py tests/fake_dists/choxie-2.0.0.9/choxie/chocolate.py tests/fake_dists/coconuts-aster-10.3.egg-info/PKG-INFO tests/fake_dists/grammar-1.0a4.dist-info/INSTALLER tests/fake_dists/grammar-1.0a4.dist-info/METADATA tests/fake_dists/grammar-1.0a4.dist-info/RECORD tests/fake_dists/grammar-1.0a4.dist-info/REQUESTED tests/fake_dists/grammar-1.0a4.dist-info/pydist.json tests/fake_dists/grammar-1.0a4/grammar/__init__.py tests/fake_dists/grammar-1.0a4/grammar/utils.py tests/fake_dists/towel_stuff-0.1.dist-info/INSTALLER tests/fake_dists/towel_stuff-0.1.dist-info/METADATA tests/fake_dists/towel_stuff-0.1.dist-info/RECORD tests/fake_dists/towel_stuff-0.1.dist-info/REQUESTED tests/fake_dists/towel_stuff-0.1.dist-info/pydist-exports.json tests/fake_dists/towel_stuff-0.1.dist-info/pydist.json tests/fake_dists/towel_stuff-0.1/towel_stuff/__init__.py tests/foofoo/__init__.py tests/foofoo/foo_resource.bin tests/foofoo/bar/__init__.py tests/foofoo/bar/bar_resource.bin tests/foofoo/bar/baz.py tests/foofoo/nested/nested_resource.bin tests/keys/.gpg-v21-migrated tests/keys/pubring.gpg tests/keys/random_seed tests/keys/secring.gpg tests/keys/trustdb.gpg tests/keys/private-keys-v1.d/89643D011E83504EFB6A88F328153504C3E2C97B.key tests/keys/private-keys-v1.d/8BE462CC6083085304DBEA3FC423A1276DAF0B2C.key tests/scripts/foo.py tests/scripts/script1.py tests/scripts/script2.py tests/scripts/script3.py tests/scripts/script4.py tests/scripts/script5.py tests/scripts/script6.py tests/scripts/script7.pyw tests/scripts/script8.py tests/scripts/shell.sh tests/scripts/uwsgi_part tests/test_testdist-0.1/LICENSE tests/test_testdist-0.1/PKG-INFO tests/test_testdist-0.1/README.txt tests/test_testdist-0.1/package.json tests/test_testdist-0.1/testdist.py tests/testdist-0.1/LICENSE tests/testdist-0.1/PKG-INFO tests/testdist-0.1/README.txt tests/testdist-0.1/package.json tests/testdist-0.1/testdist.py tests/testdist-0.1/doc/index.html tests/testsrc/.hidden tests/testsrc/LICENSE tests/testsrc/README.txt tests/testsrc/keep/keep.txt tests/testsrc/subdir/somedata.txt tests/testsrc/subdir/lose/lose.txt tests/testsrc/subdir/subsubdir/somedata.bindistlib-0.3.8/distlib.egg-info/top_level.txt0000664000175000017500000000001014536003571021325 0ustar vinayvinay00000000000000distlib distlib-0.3.8/distlib.egg-info/PKG-INFO0000664000175000017500000001203014536003571017675 0ustar vinayvinay00000000000000Metadata-Version: 2.1 Name: distlib Version: 0.3.8 Summary: Distribution utilities Home-page: https://github.com/pypa/distlib Author: Vinay Sajip Author-email: vinay_sajip@red-dove.com License: PSF-2.0 Project-URL: Documentation, https://distlib.readthedocs.io/ Project-URL: Source, https://github.com/pypa/distlib Project-URL: Tracker, https://github.com/pypa/distlib/issues Platform: any Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development License-File: LICENSE.txt |badge1| |badge2| .. |badge1| image:: https://img.shields.io/github/actions/workflow/status/pypa/distlib/package-tests.yml :alt: GitHub Workflow Status (with event) .. |badge2| image:: https://img.shields.io/codecov/c/github/pypa/distlib :target: https://app.codecov.io/gh/pypa/distlib :alt: GitHub coverage status What is it? ----------- Distlib is a library which implements low-level functions that relate to packaging and distribution of Python software. It is intended to be used as the basis for third-party packaging tools. The documentation is available at https://distlib.readthedocs.io/ Main features ------------- Distlib currently offers the following features: * The package ``distlib.database``, which implements a database of installed distributions, as defined by :pep:`376`, and distribution dependency graph logic. Support is also provided for non-installed distributions (i.e. distributions registered with metadata on an index like PyPI), including the ability to scan for dependencies and building dependency graphs. * The package ``distlib.index``, which implements an interface to perform operations on an index, such as registering a project, uploading a distribution or uploading documentation. Support is included for verifying SSL connections (with domain matching) and signing/verifying packages using GnuPG. * The package ``distlib.metadata``, which implements distribution metadata as defined by :pep:`643`, :pep:`566`, :pep:`345`, :pep:`314` and :pep:`241`. * The package ``distlib.markers``, which implements environment markers as defined by :pep:`508`. * The package ``distlib.manifest``, which implements lists of files used in packaging source distributions. * The package ``distlib.locators``, which allows finding distributions, whether on PyPI (XML-RPC or via the "simple" interface), local directories or some other source. * The package ``distlib.resources``, which allows access to data files stored in Python packages, both in the file system and in .zip files. * The package ``distlib.scripts``, which allows installing of scripts with adjustment of shebang lines and support for native Windows executable launchers. * The package ``distlib.version``, which implements version specifiers as defined by :pep:`440`, but also support for working with "legacy" versions and semantic versions. * The package ``distlib.wheel``, which provides support for building and installing from the Wheel format for binary distributions (see :pep:`427`). * The package ``distlib.util``, which contains miscellaneous functions and classes which are useful in packaging, but which do not fit neatly into one of the other packages in ``distlib``.* The package implements enhanced globbing functionality such as the ability to use ``**`` in patterns to specify recursing into subdirectories. Python version and platform compatibility ----------------------------------------- Distlib is intended to be used on and is tested on Python versions 2.7 and 3.6 or later, pypy-2.7 and pypy3 on Linux, Windows, and macOS. Project status -------------- The project has reached a mature status in its development: there is a comprehensive test suite and it has been exercised on Windows, Ubuntu and macOS. The project is used by well-known projects such as `pip `_ and `caniusepython3 `_. This project was migrated from Mercurial to Git and from BitBucket to GitHub, and although all information of importance has been retained across the migration, some commit references in issues and issue comments may have become invalid. Code of Conduct --------------- Everyone interacting in the distlib project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/ distlib-0.3.8/distlib.egg-info/dependency_links.txt0000664000175000017500000000000114536003571022652 0ustar vinayvinay00000000000000 distlib-0.3.8/tests/0000775000175000017500000000000014536003571014622 5ustar vinayvinay00000000000000distlib-0.3.8/tests/bad.tar.bz20000644000175000017500000000037613453041443016555 0ustar vinayvinay00000000000000BZh91AY&SY _SU@Ԡw'_`@0hd&j=S)!mDy 24ژ) ^:/-rQtͫ5 Kdm "ׇ