Attempt to build Python compiler program

This commit is contained in:
Justine Tunney 2021-08-17 06:28:23 -07:00
parent d522a88def
commit 0c6581f912
27 changed files with 9780 additions and 2536 deletions

Binary file not shown.

92
libc/x/utf8toutf32.c Normal file
View file

@ -0,0 +1,92 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/pcmpgtb.h"
#include "libc/intrin/pmovmskb.h"
#include "libc/intrin/punpckhbw.h"
#include "libc/intrin/punpckhwd.h"
#include "libc/intrin/punpcklbw.h"
#include "libc/intrin/punpcklwd.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/str/thompike.h"
#include "libc/str/utf16.h"
#include "libc/x/x.h"
/**
* Transcodes UTF-8 to UTF-32.
*
* @param p is input value
* @param n if -1 implies strlen
* @param z if non-NULL receives output length
*/
wchar_t *utf8toutf32(const char *p, size_t n, size_t *z) {
size_t i;
unsigned m, j;
wint_t x, a, b;
wchar_t *r, *q;
uint8_t v1[16], v2[16], v3[16], v4[16], vz[16];
if (z) *z = 0;
if (n == -1) n = p ? strlen(p) : 0;
if ((q = r = malloc(n * sizeof(wchar_t) + sizeof(wchar_t)))) {
for (i = 0; i < n;) {
if (0 && i + 16 < n) { /* 10x speedup for ascii */
memset(vz, 0, 16);
do {
memcpy(v1, p + i, 16);
pcmpgtb((int8_t *)v2, (int8_t *)v1, (int8_t *)vz);
if (pmovmskb(v2) != 0xFFFF) break;
punpcklbw(v3, v1, vz);
punpckhbw(v1, v1, vz);
punpcklwd((void *)v4, (void *)v3, (void *)vz);
punpckhwd((void *)v3, (void *)v3, (void *)vz);
punpcklwd((void *)v2, (void *)v1, (void *)vz);
punpckhwd((void *)v1, (void *)v1, (void *)vz);
memcpy(q + 0, v4, 16);
memcpy(q + 4, v3, 16);
memcpy(q + 8, v2, 16);
memcpy(q + 12, v1, 16);
i += 16;
q += 16;
} while (i + 16 < n);
}
x = p[i++] & 0xff;
if (x >= 0300) {
a = ThomPikeByte(x);
m = ThomPikeLen(x) - 1;
if (i + m <= n) {
for (j = 0;;) {
b = p[i + j] & 0xff;
if (!ThomPikeCont(b)) break;
a = ThomPikeMerge(a, b);
if (++j == m) {
x = a;
i += j;
break;
}
}
}
}
*q++ = x;
}
if (z) *z = q - r;
*q++ = '\0';
if ((q = realloc(r, (q - r) * sizeof(wchar_t)))) r = q;
}
return r;
}

View file

@ -53,7 +53,9 @@ void *xunbinga(size_t, const char16_t *) attributeallocalign((1)) _XMAL _XRET;
void *xunbing(const char16_t *) _XMAL _XRET; void *xunbing(const char16_t *) _XMAL _XRET;
char16_t *utf8toutf16(const char *, size_t, size_t *) nodiscard; char16_t *utf8toutf16(const char *, size_t, size_t *) nodiscard;
char *utf16toutf8(const char16_t *, size_t, size_t *) nodiscard; char *utf16toutf8(const char16_t *, size_t, size_t *) nodiscard;
wchar_t *utf8toutf32(const char *, size_t, size_t *) nodiscard;
char *xhomedir(void) nodiscard; char *xhomedir(void) nodiscard;
char *xstripexts(const char *) nodiscard;
/*───────────────────────────────────────────────────────────────────────────│─╗ /*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § eXtended apis » files cosmopolitan § eXtended apis » files

30
libc/x/xstripexts.c Normal file
View file

@ -0,0 +1,30 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/conv.h"
#include "libc/x/x.h"
/**
* Removes file extensions.
*
* @param s is mutated
* @return s
*/
char *xstripexts(const char *s) {
return stripexts(xstrdup(s));
}

View file

@ -4,7 +4,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
#if 0 #if 1
#define ZTRACE(FMT, ...) (dprintf)(2, FMT "\n", ##__VA_ARGS__) #define ZTRACE(FMT, ...) (dprintf)(2, FMT "\n", ##__VA_ARGS__)
#else #else
#define ZTRACE(FMT, ...) (void)0 #define ZTRACE(FMT, ...) (void)0

View file

@ -18,7 +18,9 @@
*/ */
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/x/x.h"
TEST(stripexts, test) { TEST(stripexts, test) {
char s[] = "foo/bar.com.dbg"; char s[] = "foo/bar.com.dbg";
@ -29,3 +31,11 @@ TEST(stripexts, test2) {
char s[] = "foo/bar.com.dbg"; char s[] = "foo/bar.com.dbg";
EXPECT_STREQ("bar", stripexts(basename(s))); EXPECT_STREQ("bar", stripexts(basename(s)));
} }
TEST(xstripexts, test) {
EXPECT_STREQ("foo/bar", gc(xstripexts("foo/bar.com.dbg")));
}
TEST(xstripexts, test2) {
EXPECT_STREQ("bar", gc(xstripexts(basename("foo/bar.com.dbg"))));
}

View file

@ -0,0 +1,53 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
TEST(utf8toutf32, test) {
EXPECT_STREQ(L"", gc(utf8toutf32(0, 0, 0)));
EXPECT_STREQ(L"", gc(utf8toutf32("", -1, 0)));
EXPECT_STREQ(L"hello", gc(utf8toutf32("hello", -1, 0)));
}
TEST(utf8toutf32, testLargeAscii) {
EXPECT_STREQ(L"hellohellohelloz", gc(utf8toutf32("hellohellohelloz", -1, 0)));
EXPECT_STREQ(L"hellohellohellozhellohellohelloz",
gc(utf8toutf32("hellohellohellozhellohellohelloz", -1, 0)));
}
TEST(utf8toutf32, testLargeThompsonPikeEncoded) {
EXPECT_STREQ(L"hellohellohello𝑧hellohellohelloz",
gc(utf8toutf32("hellohellohello𝑧hellohellohelloz", -1, 0)));
EXPECT_STREQ(L"hellohellohelloh𝑧ellohellohelloz",
gc(utf8toutf32("hellohellohelloh𝑧ellohellohelloz", -1, 0)));
EXPECT_STREQ(
L"𝑕𝑒𝑙𝑙𝑜𝑕𝑒𝑙𝑙𝑜𝑕𝑒𝑙𝑙𝑜𝑧",
gc(utf8toutf32(
"𝑕𝑒𝑙𝑙𝑜𝑕𝑒𝑙𝑙𝑜𝑕𝑒𝑙𝑙𝑜𝑧",
-1, 0)));
}
BENCH(utf8toutf32, bench) {
EZBENCH2("utf8toutf32", donothing,
free(utf8toutf32(kHyperion, kHyperionSize, 0)));
}

View file

@ -29,6 +29,6 @@ TEST(StripComponents, test) {
EXPECT_STREQ("hello", StripComponents("a/b/hello", 3)); EXPECT_STREQ("hello", StripComponents("a/b/hello", 3));
EXPECT_STREQ("hello", StripComponents("a/b/hello", 2)); EXPECT_STREQ("hello", StripComponents("a/b/hello", 2));
EXPECT_STREQ("b/hello", StripComponents("a/b/hello", 1)); EXPECT_STREQ("b/hello", StripComponents("a/b/hello", 1));
EXPECT_STREQ("hello", StripComponents("a///b/hello", 2)); EXPECT_STREQ("/foo/bar", StripComponents("o//foo/bar", 1));
EXPECT_STREQ("b/hello", StripComponents("///a/b/hello", 1)); EXPECT_STREQ("foo/bar", StripComponents("o//foo/bar", 2));
} }

View file

@ -1,5 +1,6 @@
#ifndef Py_PYTHONRUN_H #ifndef Py_PYTHONRUN_H
#define Py_PYTHONRUN_H #define Py_PYTHONRUN_H
#include "third_party/python/Include/code.h"
#include "third_party/python/Include/object.h" #include "third_party/python/Include/object.h"
#include "third_party/python/Include/pyarena.h" #include "third_party/python/Include/pyarena.h"
#include "third_party/python/Include/pystate.h" #include "third_party/python/Include/pystate.h"

View file

@ -467,6 +467,7 @@ static void
calculate_path(void) calculate_path(void)
{ {
module_search_path = L"zip!.python/"; module_search_path = L"zip!.python/";
/* module_search_path = L"third_party/python/Lib/"; */
} }

View file

@ -0,0 +1,33 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/dce.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
/**
* Returns 1 for Unicode characters having the line break
* property 'BK', 'CR', 'LF' or 'NL' or having bidirectional
* type 'B', 0 otherwise.
*/
int _PyUnicode_IsLinebreak(const Py_UCS4 ch)
{
switch (ch) {
case 0x000A:
case 0x000B:
case 0x000C:
case 0x000D:
case 0x001C:
case 0x001D:
case 0x001E:
case 0x0085:
case 0x2028:
case 0x2029:
return 1;
default:
return 0;
}
}

View file

@ -0,0 +1,51 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/dce.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
/**
* Returns 1 for Unicode characters having the bidirectional
* type 'WS', 'B' or 'S' or the category 'Zs', 0 otherwise.
*/
int _PyUnicode_IsWhitespace(const Py_UCS4 ch)
{
switch (ch) {
case 0x0009:
case 0x000A:
case 0x000B:
case 0x000C:
case 0x000D:
case 0x001C:
case 0x001D:
case 0x001E:
case 0x001F:
case 0x0020:
case 0x0085:
case 0x00A0:
case 0x1680:
case 0x2000:
case 0x2001:
case 0x2002:
case 0x2003:
case 0x2004:
case 0x2005:
case 0x2006:
case 0x2007:
case 0x2008:
case 0x2009:
case 0x200A:
case 0x2028:
case 0x2029:
case 0x202F:
case 0x205F:
case 0x3000:
return 1;
default:
return 0;
}
}

View file

@ -5030,7 +5030,7 @@ PyUnicode_DecodeUTF8(const char *s,
# error C 'long' size should be either 4 or 8! # error C 'long' size should be either 4 or 8!
#endif #endif
static Py_ssize_t static optimizespeed Py_ssize_t
ascii_decode(const char *start, const char *end, Py_UCS1 *dest) ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
{ {
const char *p = start; const char *p = start;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -65,7 +65,7 @@ fixdfa(grammar *g, dfa *d)
fixstate(g, s); fixstate(g, s);
} }
static void static optimizespeed void
fixstate(grammar *g, state *s) fixstate(grammar *g, state *s)
{ {
arc *a; arc *a;

View file

@ -16,6 +16,24 @@
#include "third_party/python/Include/pythonrun.h" #include "third_party/python/Include/pythonrun.h"
/* clang-format off */ /* clang-format off */
#define HEADER "\
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│\n\
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi\n\
\n\
Python 3 \n\
https://docs.python.org/3/license.html \n\
*/\n\
/* clang-format off */\n\
\n\
/*\n\
* Auto-generated by\n\
* %s \\\n\
* %s \\\n\
* %s\n\
*/\n\
\n\
"
/* This is built as a stand-alone executable by the Makefile, and helps turn /* This is built as a stand-alone executable by the Makefile, and helps turn
Lib/importlib/_bootstrap.py into a frozen module in Python/importlib.h Lib/importlib/_bootstrap.py into a frozen module in Python/importlib.h
*/ */
@ -35,23 +53,25 @@ static const struct _frozen _PyImport_FrozenModules[] = {
const struct _frozen *PyImport_FrozenModules; const struct _frozen *PyImport_FrozenModules;
#endif #endif
#define HEADER "\ PyObject *PyMarshal_Init(void);
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│\n\ PyObject *PyInit_gc(void);
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi\n\ PyObject *PyInit__ast(void);
\n\ PyObject *_PyWarnings_Init(void);
Python 3 \n\ PyObject *PyInit__string(void);
https://docs.python.org/3/license.html \n\
*/\n\ struct _inittab _PyImport_Inittab[] = {
/* clang-format off */\n\ {"marshal", PyMarshal_Init},
\n\ {"_imp", PyInit_imp},
/*\n\ {"_ast", PyInit__ast},
* Auto-generated by\n\ {"builtins"},
* %s \\\n\ {"sys"},
* %s \\\n\ {"gc", PyInit_gc},
* %s\n\ {"_warnings", _PyWarnings_Init},
*/\n\ {"_string", PyInit__string},
\n\ {0}
" };
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])

View file

@ -27,6 +27,9 @@
#include "third_party/python/Include/unicodeobject.h" #include "third_party/python/Include/unicodeobject.h"
/* clang-format off */ /* clang-format off */
extern struct _inittab _PyImport_Inittab[];
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
static jmp_buf jbuf; static jmp_buf jbuf;
static void static void

View file

@ -40,11 +40,6 @@
/* See _PyImport_FixupExtensionObject() below */ /* See _PyImport_FixupExtensionObject() below */
static PyObject *extensions = NULL; static PyObject *extensions = NULL;
/* This table is defined in config.c: */
extern struct _inittab _PyImport_Inittab[];
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
static PyObject *initstr = NULL; static PyObject *initstr = NULL;
/*[clinic input] /*[clinic input]

View file

@ -26,6 +26,7 @@
#include "third_party/python/Include/pydebug.h" #include "third_party/python/Include/pydebug.h"
#include "third_party/python/Include/pyerrors.h" #include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pylifecycle.h" #include "third_party/python/Include/pylifecycle.h"
#include "third_party/python/Include/pythonrun.h"
#include "third_party/python/Include/setobject.h" #include "third_party/python/Include/setobject.h"
#include "third_party/python/Include/symtable.h" #include "third_party/python/Include/symtable.h"
#include "third_party/python/Include/sysmodule.h" #include "third_party/python/Include/sysmodule.h"

666
third_party/python/makegen.py vendored Normal file
View file

@ -0,0 +1,666 @@
import os
PYCOMP = "o/$(MODE)/third_party/python/pycomp"
SAUCES = (
"third_party/python/Lib",
"third_party/python/Lib/__future__.py",
"third_party/python/Lib/_bootlocale.py",
"third_party/python/Lib/_collections_abc.py",
"third_party/python/Lib/_compat_pickle.py",
"third_party/python/Lib/_compression.py",
"third_party/python/Lib/_dummy_thread.py",
"third_party/python/Lib/_markupbase.py",
"third_party/python/Lib/_osx_support.py",
"third_party/python/Lib/_pyio.py",
"third_party/python/Lib/_sitebuiltins.py",
"third_party/python/Lib/_strptime.py",
"third_party/python/Lib/_sysconfigdata_m_cosmo_x86_64-cosmo.py",
"third_party/python/Lib/_threading_local.py",
"third_party/python/Lib/_weakrefset.py",
"third_party/python/Lib/abc.py",
"third_party/python/Lib/aifc.py",
"third_party/python/Lib/antigravity.py",
"third_party/python/Lib/argparse.py",
"third_party/python/Lib/ast.py",
"third_party/python/Lib/asynchat.py",
"third_party/python/Lib/asyncio",
"third_party/python/Lib/asyncio/__init__.py",
"third_party/python/Lib/asyncio/base_events.py",
"third_party/python/Lib/asyncio/base_futures.py",
"third_party/python/Lib/asyncio/base_subprocess.py",
"third_party/python/Lib/asyncio/base_tasks.py",
"third_party/python/Lib/asyncio/compat.py",
"third_party/python/Lib/asyncio/constants.py",
"third_party/python/Lib/asyncio/coroutines.py",
"third_party/python/Lib/asyncio/events.py",
"third_party/python/Lib/asyncio/futures.py",
"third_party/python/Lib/asyncio/locks.py",
"third_party/python/Lib/asyncio/log.py",
"third_party/python/Lib/asyncio/proactor_events.py",
"third_party/python/Lib/asyncio/protocols.py",
"third_party/python/Lib/asyncio/queues.py",
"third_party/python/Lib/asyncio/selector_events.py",
"third_party/python/Lib/asyncio/sslproto.py",
"third_party/python/Lib/asyncio/streams.py",
"third_party/python/Lib/asyncio/subprocess.py",
"third_party/python/Lib/asyncio/tasks.py",
"third_party/python/Lib/asyncio/test_utils.py",
"third_party/python/Lib/asyncio/transports.py",
"third_party/python/Lib/asyncio/unix_events.py",
"third_party/python/Lib/asyncio/windows_events.py",
"third_party/python/Lib/asyncio/windows_utils.py",
"third_party/python/Lib/asyncore.py",
"third_party/python/Lib/base64.py",
"third_party/python/Lib/bdb.py",
"third_party/python/Lib/binhex.py",
"third_party/python/Lib/bisect.py",
"third_party/python/Lib/bz2.py",
"third_party/python/Lib/cProfile.py",
"third_party/python/Lib/calendar.py",
"third_party/python/Lib/cgi.py",
"third_party/python/Lib/cgitb.py",
"third_party/python/Lib/chunk.py",
"third_party/python/Lib/cmd.py",
"third_party/python/Lib/code.py",
"third_party/python/Lib/codecs.py",
"third_party/python/Lib/codeop.py",
"third_party/python/Lib/collections",
"third_party/python/Lib/collections/__init__.py",
"third_party/python/Lib/collections/abc.py",
"third_party/python/Lib/colorsys.py",
"third_party/python/Lib/compileall.py",
"third_party/python/Lib/configparser.py",
"third_party/python/Lib/contextlib.py",
"third_party/python/Lib/copy.py",
"third_party/python/Lib/copyreg.py",
"third_party/python/Lib/crypt.py",
"third_party/python/Lib/csv.py",
"third_party/python/Lib/datetime.py",
"third_party/python/Lib/dbm",
"third_party/python/Lib/dbm/__init__.py",
"third_party/python/Lib/dbm/dumb.py",
"third_party/python/Lib/dbm/gnu.py",
"third_party/python/Lib/dbm/ndbm.py",
"third_party/python/Lib/decimal.py",
"third_party/python/Lib/difflib.py",
"third_party/python/Lib/dis.py",
"third_party/python/Lib/distutils",
"third_party/python/Lib/distutils/__init__.py",
"third_party/python/Lib/distutils/_msvccompiler.py",
"third_party/python/Lib/distutils/archive_util.py",
"third_party/python/Lib/distutils/bcppcompiler.py",
"third_party/python/Lib/distutils/ccompiler.py",
"third_party/python/Lib/distutils/cmd.py",
"third_party/python/Lib/distutils/command",
"third_party/python/Lib/distutils/command/__init__.py",
"third_party/python/Lib/distutils/command/bdist.py",
"third_party/python/Lib/distutils/command/bdist_dumb.py",
"third_party/python/Lib/distutils/command/bdist_msi.py",
"third_party/python/Lib/distutils/command/bdist_rpm.py",
"third_party/python/Lib/distutils/command/bdist_wininst.py",
"third_party/python/Lib/distutils/command/build.py",
"third_party/python/Lib/distutils/command/build_clib.py",
"third_party/python/Lib/distutils/command/build_ext.py",
"third_party/python/Lib/distutils/command/build_py.py",
"third_party/python/Lib/distutils/command/build_scripts.py",
"third_party/python/Lib/distutils/command/check.py",
"third_party/python/Lib/distutils/command/clean.py",
"third_party/python/Lib/distutils/command/command_template",
"third_party/python/Lib/distutils/command/config.py",
"third_party/python/Lib/distutils/command/install.py",
"third_party/python/Lib/distutils/command/install_data.py",
"third_party/python/Lib/distutils/command/install_egg_info.py",
"third_party/python/Lib/distutils/command/install_headers.py",
"third_party/python/Lib/distutils/command/install_lib.py",
"third_party/python/Lib/distutils/command/install_scripts.py",
"third_party/python/Lib/distutils/command/register.py",
"third_party/python/Lib/distutils/command/sdist.py",
"third_party/python/Lib/distutils/command/upload.py",
"third_party/python/Lib/distutils/config.py",
"third_party/python/Lib/distutils/core.py",
"third_party/python/Lib/distutils/cygwinccompiler.py",
"third_party/python/Lib/distutils/debug.py",
"third_party/python/Lib/distutils/dep_util.py",
"third_party/python/Lib/distutils/dir_util.py",
"third_party/python/Lib/distutils/dist.py",
"third_party/python/Lib/distutils/errors.py",
"third_party/python/Lib/distutils/extension.py",
"third_party/python/Lib/distutils/fancy_getopt.py",
"third_party/python/Lib/distutils/file_util.py",
"third_party/python/Lib/distutils/filelist.py",
"third_party/python/Lib/distutils/log.py",
"third_party/python/Lib/distutils/msvc9compiler.py",
"third_party/python/Lib/distutils/msvccompiler.py",
"third_party/python/Lib/distutils/spawn.py",
"third_party/python/Lib/distutils/sysconfig.py",
"third_party/python/Lib/distutils/tests",
"third_party/python/Lib/distutils/tests/Setup.sample",
"third_party/python/Lib/distutils/tests/__init__.py",
"third_party/python/Lib/distutils/tests/support.py",
"third_party/python/Lib/distutils/tests/test_archive_util.py",
"third_party/python/Lib/distutils/tests/test_bdist.py",
"third_party/python/Lib/distutils/tests/test_bdist_dumb.py",
"third_party/python/Lib/distutils/tests/test_bdist_msi.py",
"third_party/python/Lib/distutils/tests/test_bdist_rpm.py",
"third_party/python/Lib/distutils/tests/test_bdist_wininst.py",
"third_party/python/Lib/distutils/tests/test_build.py",
"third_party/python/Lib/distutils/tests/test_build_clib.py",
"third_party/python/Lib/distutils/tests/test_build_ext.py",
"third_party/python/Lib/distutils/tests/test_build_py.py",
"third_party/python/Lib/distutils/tests/test_build_scripts.py",
"third_party/python/Lib/distutils/tests/test_check.py",
"third_party/python/Lib/distutils/tests/test_clean.py",
"third_party/python/Lib/distutils/tests/test_cmd.py",
"third_party/python/Lib/distutils/tests/test_config.py",
"third_party/python/Lib/distutils/tests/test_config_cmd.py",
"third_party/python/Lib/distutils/tests/test_core.py",
"third_party/python/Lib/distutils/tests/test_cygwinccompiler.py",
"third_party/python/Lib/distutils/tests/test_dep_util.py",
"third_party/python/Lib/distutils/tests/test_dir_util.py",
"third_party/python/Lib/distutils/tests/test_dist.py",
"third_party/python/Lib/distutils/tests/test_extension.py",
"third_party/python/Lib/distutils/tests/test_file_util.py",
"third_party/python/Lib/distutils/tests/test_filelist.py",
"third_party/python/Lib/distutils/tests/test_install.py",
"third_party/python/Lib/distutils/tests/test_install_data.py",
"third_party/python/Lib/distutils/tests/test_install_headers.py",
"third_party/python/Lib/distutils/tests/test_install_lib.py",
"third_party/python/Lib/distutils/tests/test_install_scripts.py",
"third_party/python/Lib/distutils/tests/test_log.py",
"third_party/python/Lib/distutils/tests/test_msvc9compiler.py",
"third_party/python/Lib/distutils/tests/test_msvccompiler.py",
"third_party/python/Lib/distutils/tests/test_register.py",
"third_party/python/Lib/distutils/tests/test_sdist.py",
"third_party/python/Lib/distutils/tests/test_spawn.py",
"third_party/python/Lib/distutils/tests/test_sysconfig.py",
"third_party/python/Lib/distutils/tests/test_text_file.py",
"third_party/python/Lib/distutils/tests/test_unixccompiler.py",
"third_party/python/Lib/distutils/tests/test_upload.py",
"third_party/python/Lib/distutils/tests/test_util.py",
"third_party/python/Lib/distutils/tests/test_version.py",
"third_party/python/Lib/distutils/tests/test_versionpredicate.py",
"third_party/python/Lib/distutils/text_file.py",
"third_party/python/Lib/distutils/unixccompiler.py",
"third_party/python/Lib/distutils/util.py",
"third_party/python/Lib/distutils/version.py",
"third_party/python/Lib/distutils/versionpredicate.py",
"third_party/python/Lib/doctest.py",
"third_party/python/Lib/dummy_threading.py",
"third_party/python/Lib/email",
"third_party/python/Lib/email/__init__.py",
"third_party/python/Lib/email/_encoded_words.py",
"third_party/python/Lib/email/_header_value_parser.py",
"third_party/python/Lib/email/_parseaddr.py",
"third_party/python/Lib/email/_policybase.py",
"third_party/python/Lib/email/architecture.rst",
"third_party/python/Lib/email/base64mime.py",
"third_party/python/Lib/email/charset.py",
"third_party/python/Lib/email/contentmanager.py",
"third_party/python/Lib/email/encoders.py",
"third_party/python/Lib/email/errors.py",
"third_party/python/Lib/email/feedparser.py",
"third_party/python/Lib/email/generator.py",
"third_party/python/Lib/email/header.py",
"third_party/python/Lib/email/headerregistry.py",
"third_party/python/Lib/email/iterators.py",
"third_party/python/Lib/email/message.py",
"third_party/python/Lib/email/mime",
"third_party/python/Lib/email/mime/__init__.py",
"third_party/python/Lib/email/mime/application.py",
"third_party/python/Lib/email/mime/audio.py",
"third_party/python/Lib/email/mime/base.py",
"third_party/python/Lib/email/mime/image.py",
"third_party/python/Lib/email/mime/message.py",
"third_party/python/Lib/email/mime/multipart.py",
"third_party/python/Lib/email/mime/nonmultipart.py",
"third_party/python/Lib/email/mime/text.py",
"third_party/python/Lib/email/parser.py",
"third_party/python/Lib/email/policy.py",
"third_party/python/Lib/email/quoprimime.py",
"third_party/python/Lib/email/utils.py",
"third_party/python/Lib/encodings",
"third_party/python/Lib/encodings/__init__.py",
"third_party/python/Lib/encodings/aliases.py",
"third_party/python/Lib/encodings/ascii.py",
"third_party/python/Lib/encodings/base64_codec.py",
"third_party/python/Lib/encodings/big5.py",
"third_party/python/Lib/encodings/big5hkscs.py",
"third_party/python/Lib/encodings/bz2_codec.py",
"third_party/python/Lib/encodings/charmap.py",
"third_party/python/Lib/encodings/cp037.py",
"third_party/python/Lib/encodings/cp1006.py",
"third_party/python/Lib/encodings/cp1026.py",
"third_party/python/Lib/encodings/cp1125.py",
"third_party/python/Lib/encodings/cp1140.py",
"third_party/python/Lib/encodings/cp1250.py",
"third_party/python/Lib/encodings/cp1251.py",
"third_party/python/Lib/encodings/cp1252.py",
"third_party/python/Lib/encodings/cp1253.py",
"third_party/python/Lib/encodings/cp1254.py",
"third_party/python/Lib/encodings/cp1255.py",
"third_party/python/Lib/encodings/cp1256.py",
"third_party/python/Lib/encodings/cp1257.py",
"third_party/python/Lib/encodings/cp1258.py",
"third_party/python/Lib/encodings/cp273.py",
"third_party/python/Lib/encodings/cp424.py",
"third_party/python/Lib/encodings/cp437.py",
"third_party/python/Lib/encodings/cp500.py",
"third_party/python/Lib/encodings/cp65001.py",
"third_party/python/Lib/encodings/cp720.py",
"third_party/python/Lib/encodings/cp737.py",
"third_party/python/Lib/encodings/cp775.py",
"third_party/python/Lib/encodings/cp850.py",
"third_party/python/Lib/encodings/cp852.py",
"third_party/python/Lib/encodings/cp855.py",
"third_party/python/Lib/encodings/cp856.py",
"third_party/python/Lib/encodings/cp857.py",
"third_party/python/Lib/encodings/cp858.py",
"third_party/python/Lib/encodings/cp860.py",
"third_party/python/Lib/encodings/cp861.py",
"third_party/python/Lib/encodings/cp862.py",
"third_party/python/Lib/encodings/cp863.py",
"third_party/python/Lib/encodings/cp864.py",
"third_party/python/Lib/encodings/cp865.py",
"third_party/python/Lib/encodings/cp866.py",
"third_party/python/Lib/encodings/cp869.py",
"third_party/python/Lib/encodings/cp874.py",
"third_party/python/Lib/encodings/cp875.py",
"third_party/python/Lib/encodings/cp932.py",
"third_party/python/Lib/encodings/cp949.py",
"third_party/python/Lib/encodings/cp950.py",
"third_party/python/Lib/encodings/euc_jis_2004.py",
"third_party/python/Lib/encodings/euc_jisx0213.py",
"third_party/python/Lib/encodings/euc_jp.py",
"third_party/python/Lib/encodings/euc_kr.py",
"third_party/python/Lib/encodings/gb18030.py",
"third_party/python/Lib/encodings/gb2312.py",
"third_party/python/Lib/encodings/gbk.py",
"third_party/python/Lib/encodings/hex_codec.py",
"third_party/python/Lib/encodings/hp_roman8.py",
"third_party/python/Lib/encodings/hz.py",
"third_party/python/Lib/encodings/idna.py",
"third_party/python/Lib/encodings/iso2022_jp.py",
"third_party/python/Lib/encodings/iso2022_jp_1.py",
"third_party/python/Lib/encodings/iso2022_jp_2.py",
"third_party/python/Lib/encodings/iso2022_jp_2004.py",
"third_party/python/Lib/encodings/iso2022_jp_3.py",
"third_party/python/Lib/encodings/iso2022_jp_ext.py",
"third_party/python/Lib/encodings/iso2022_kr.py",
"third_party/python/Lib/encodings/iso8859_1.py",
"third_party/python/Lib/encodings/iso8859_10.py",
"third_party/python/Lib/encodings/iso8859_11.py",
"third_party/python/Lib/encodings/iso8859_13.py",
"third_party/python/Lib/encodings/iso8859_14.py",
"third_party/python/Lib/encodings/iso8859_15.py",
"third_party/python/Lib/encodings/iso8859_16.py",
"third_party/python/Lib/encodings/iso8859_2.py",
"third_party/python/Lib/encodings/iso8859_3.py",
"third_party/python/Lib/encodings/iso8859_4.py",
"third_party/python/Lib/encodings/iso8859_5.py",
"third_party/python/Lib/encodings/iso8859_6.py",
"third_party/python/Lib/encodings/iso8859_7.py",
"third_party/python/Lib/encodings/iso8859_8.py",
"third_party/python/Lib/encodings/iso8859_9.py",
"third_party/python/Lib/encodings/johab.py",
"third_party/python/Lib/encodings/koi8_r.py",
"third_party/python/Lib/encodings/koi8_t.py",
"third_party/python/Lib/encodings/koi8_u.py",
"third_party/python/Lib/encodings/kz1048.py",
"third_party/python/Lib/encodings/latin_1.py",
"third_party/python/Lib/encodings/mac_arabic.py",
"third_party/python/Lib/encodings/mac_centeuro.py",
"third_party/python/Lib/encodings/mac_croatian.py",
"third_party/python/Lib/encodings/mac_cyrillic.py",
"third_party/python/Lib/encodings/mac_farsi.py",
"third_party/python/Lib/encodings/mac_greek.py",
"third_party/python/Lib/encodings/mac_iceland.py",
"third_party/python/Lib/encodings/mac_latin2.py",
"third_party/python/Lib/encodings/mac_roman.py",
"third_party/python/Lib/encodings/mac_romanian.py",
"third_party/python/Lib/encodings/mac_turkish.py",
"third_party/python/Lib/encodings/mbcs.py",
"third_party/python/Lib/encodings/oem.py",
"third_party/python/Lib/encodings/palmos.py",
"third_party/python/Lib/encodings/ptcp154.py",
"third_party/python/Lib/encodings/punycode.py",
"third_party/python/Lib/encodings/quopri_codec.py",
"third_party/python/Lib/encodings/raw_unicode_escape.py",
"third_party/python/Lib/encodings/rot_13.py",
"third_party/python/Lib/encodings/shift_jis.py",
"third_party/python/Lib/encodings/shift_jis_2004.py",
"third_party/python/Lib/encodings/shift_jisx0213.py",
"third_party/python/Lib/encodings/tis_620.py",
"third_party/python/Lib/encodings/undefined.py",
"third_party/python/Lib/encodings/unicode_escape.py",
"third_party/python/Lib/encodings/unicode_internal.py",
"third_party/python/Lib/encodings/utf_16.py",
"third_party/python/Lib/encodings/utf_16_be.py",
"third_party/python/Lib/encodings/utf_16_le.py",
"third_party/python/Lib/encodings/utf_32.py",
"third_party/python/Lib/encodings/utf_32_be.py",
"third_party/python/Lib/encodings/utf_32_le.py",
"third_party/python/Lib/encodings/utf_7.py",
"third_party/python/Lib/encodings/utf_8.py",
"third_party/python/Lib/encodings/utf_8_sig.py",
"third_party/python/Lib/encodings/uu_codec.py",
"third_party/python/Lib/encodings/zlib_codec.py",
"third_party/python/Lib/ensurepip",
"third_party/python/Lib/ensurepip/__init__.py",
"third_party/python/Lib/ensurepip/__main__.py",
"third_party/python/Lib/ensurepip/_bundled",
"third_party/python/Lib/ensurepip/_bundled/pip-18.1-py2.py3-none-any.whl",
"third_party/python/Lib/ensurepip/_bundled/setuptools-40.6.2-py2.py3-none-any.whl",
"third_party/python/Lib/ensurepip/_uninstall.py",
"third_party/python/Lib/enum.py",
"third_party/python/Lib/filecmp.py",
"third_party/python/Lib/fileinput.py",
"third_party/python/Lib/fnmatch.py",
"third_party/python/Lib/formatter.py",
"third_party/python/Lib/fractions.py",
"third_party/python/Lib/ftplib.py",
"third_party/python/Lib/functools.py",
"third_party/python/Lib/genericpath.py",
"third_party/python/Lib/getopt.py",
"third_party/python/Lib/getpass.py",
"third_party/python/Lib/gettext.py",
"third_party/python/Lib/glob.py",
"third_party/python/Lib/gzip.py",
"third_party/python/Lib/hashlib.py",
"third_party/python/Lib/heapq.py",
"third_party/python/Lib/hmac.py",
"third_party/python/Lib/html",
"third_party/python/Lib/html/__init__.py",
"third_party/python/Lib/html/entities.py",
"third_party/python/Lib/html/parser.py",
"third_party/python/Lib/http",
"third_party/python/Lib/http/__init__.py",
"third_party/python/Lib/http/client.py",
"third_party/python/Lib/http/cookiejar.py",
"third_party/python/Lib/http/cookies.py",
"third_party/python/Lib/http/server.py",
"third_party/python/Lib/imaplib.py",
"third_party/python/Lib/imghdr.py",
"third_party/python/Lib/imp.py",
"third_party/python/Lib/importlib",
"third_party/python/Lib/importlib/__init__.py",
"third_party/python/Lib/importlib/_bootstrap.py",
"third_party/python/Lib/importlib/_bootstrap_external.py",
"third_party/python/Lib/importlib/abc.py",
"third_party/python/Lib/importlib/machinery.py",
"third_party/python/Lib/importlib/util.py",
"third_party/python/Lib/inspect.py",
"third_party/python/Lib/io.py",
"third_party/python/Lib/ipaddress.py",
"third_party/python/Lib/json",
"third_party/python/Lib/json/__init__.py",
"third_party/python/Lib/json/decoder.py",
"third_party/python/Lib/json/encoder.py",
"third_party/python/Lib/json/scanner.py",
"third_party/python/Lib/json/tool.py",
"third_party/python/Lib/keyword.py",
"third_party/python/Lib/linecache.py",
"third_party/python/Lib/locale.py",
"third_party/python/Lib/logging",
"third_party/python/Lib/logging/__init__.py",
"third_party/python/Lib/logging/config.py",
"third_party/python/Lib/logging/handlers.py",
"third_party/python/Lib/lzma.py",
"third_party/python/Lib/macpath.py",
"third_party/python/Lib/macurl2path.py",
"third_party/python/Lib/mailbox.py",
"third_party/python/Lib/mailcap.py",
"third_party/python/Lib/mimetypes.py",
"third_party/python/Lib/modulefinder.py",
"third_party/python/Lib/msilib",
"third_party/python/Lib/msilib/__init__.py",
"third_party/python/Lib/msilib/schema.py",
"third_party/python/Lib/msilib/sequence.py",
"third_party/python/Lib/msilib/text.py",
"third_party/python/Lib/multiprocessing",
"third_party/python/Lib/multiprocessing/__init__.py",
"third_party/python/Lib/multiprocessing/connection.py",
"third_party/python/Lib/multiprocessing/context.py",
"third_party/python/Lib/multiprocessing/dummy",
"third_party/python/Lib/multiprocessing/dummy/__init__.py",
"third_party/python/Lib/multiprocessing/dummy/connection.py",
"third_party/python/Lib/multiprocessing/forkserver.py",
"third_party/python/Lib/multiprocessing/heap.py",
"third_party/python/Lib/multiprocessing/managers.py",
"third_party/python/Lib/multiprocessing/pool.py",
"third_party/python/Lib/multiprocessing/popen_fork.py",
"third_party/python/Lib/multiprocessing/popen_forkserver.py",
"third_party/python/Lib/multiprocessing/popen_spawn_posix.py",
"third_party/python/Lib/multiprocessing/popen_spawn_win32.py",
"third_party/python/Lib/multiprocessing/process.py",
"third_party/python/Lib/multiprocessing/queues.py",
"third_party/python/Lib/multiprocessing/reduction.py",
"third_party/python/Lib/multiprocessing/resource_sharer.py",
"third_party/python/Lib/multiprocessing/semaphore_tracker.py",
"third_party/python/Lib/multiprocessing/sharedctypes.py",
"third_party/python/Lib/multiprocessing/spawn.py",
"third_party/python/Lib/multiprocessing/synchronize.py",
"third_party/python/Lib/multiprocessing/util.py",
"third_party/python/Lib/netrc.py",
"third_party/python/Lib/nntplib.py",
"third_party/python/Lib/ntpath.py",
"third_party/python/Lib/nturl2path.py",
"third_party/python/Lib/numbers.py",
"third_party/python/Lib/opcode.py",
"third_party/python/Lib/operator.py",
"third_party/python/Lib/optparse.py",
"third_party/python/Lib/os.py",
"third_party/python/Lib/pathlib.py",
"third_party/python/Lib/pdb.py",
"third_party/python/Lib/pickle.py",
"third_party/python/Lib/pickletools.py",
"third_party/python/Lib/pipes.py",
"third_party/python/Lib/pkgutil.py",
"third_party/python/Lib/platform.py",
"third_party/python/Lib/plistlib.py",
"third_party/python/Lib/poplib.py",
"third_party/python/Lib/posixpath.py",
"third_party/python/Lib/pprint.py",
"third_party/python/Lib/profile.py",
"third_party/python/Lib/pstats.py",
"third_party/python/Lib/pty.py",
"third_party/python/Lib/py_compile.py",
"third_party/python/Lib/pyclbr.py",
"third_party/python/Lib/pydoc.py",
"third_party/python/Lib/queue.py",
"third_party/python/Lib/quopri.py",
"third_party/python/Lib/random.py",
"third_party/python/Lib/re.py",
"third_party/python/Lib/reprlib.py",
"third_party/python/Lib/rlcompleter.py",
"third_party/python/Lib/runpy.py",
"third_party/python/Lib/sched.py",
"third_party/python/Lib/secrets.py",
"third_party/python/Lib/selectors.py",
"third_party/python/Lib/shelve.py",
"third_party/python/Lib/shlex.py",
"third_party/python/Lib/shutil.py",
"third_party/python/Lib/signal.py",
"third_party/python/Lib/site.py",
"third_party/python/Lib/smtpd.py",
"third_party/python/Lib/smtplib.py",
"third_party/python/Lib/sndhdr.py",
"third_party/python/Lib/socket.py",
"third_party/python/Lib/socketserver.py",
"third_party/python/Lib/sqlite3",
"third_party/python/Lib/sqlite3/__init__.py",
"third_party/python/Lib/sqlite3/dbapi2.py",
"third_party/python/Lib/sqlite3/dump.py",
"third_party/python/Lib/sre_compile.py",
"third_party/python/Lib/sre_constants.py",
"third_party/python/Lib/sre_parse.py",
"third_party/python/Lib/ssl.py",
"third_party/python/Lib/stat.py",
"third_party/python/Lib/statistics.py",
"third_party/python/Lib/string.py",
"third_party/python/Lib/stringprep.py",
"third_party/python/Lib/struct.py",
"third_party/python/Lib/subprocess.py",
"third_party/python/Lib/sunau.py",
"third_party/python/Lib/symbol.py",
"third_party/python/Lib/symtable.py",
"third_party/python/Lib/sysconfig.py",
"third_party/python/Lib/tabnanny.py",
"third_party/python/Lib/tarfile.py",
"third_party/python/Lib/telnetlib.py",
"third_party/python/Lib/tempfile.py",
"third_party/python/Lib/textwrap.py",
"third_party/python/Lib/this.py",
"third_party/python/Lib/threading.py",
"third_party/python/Lib/timeit.py",
"third_party/python/Lib/token.py",
"third_party/python/Lib/tokenize.py",
"third_party/python/Lib/trace.py",
"third_party/python/Lib/traceback.py",
"third_party/python/Lib/tracemalloc.py",
"third_party/python/Lib/tty.py",
"third_party/python/Lib/types.py",
"third_party/python/Lib/typing.py",
"third_party/python/Lib/unittest",
"third_party/python/Lib/unittest/__init__.py",
"third_party/python/Lib/unittest/__main__.py",
"third_party/python/Lib/unittest/case.py",
"third_party/python/Lib/unittest/loader.py",
"third_party/python/Lib/unittest/main.py",
"third_party/python/Lib/unittest/mock.py",
"third_party/python/Lib/unittest/result.py",
"third_party/python/Lib/unittest/runner.py",
"third_party/python/Lib/unittest/signals.py",
"third_party/python/Lib/unittest/suite.py",
"third_party/python/Lib/unittest/util.py",
"third_party/python/Lib/urllib",
"third_party/python/Lib/urllib/__init__.py",
"third_party/python/Lib/urllib/error.py",
"third_party/python/Lib/urllib/parse.py",
"third_party/python/Lib/urllib/request.py",
"third_party/python/Lib/urllib/response.py",
"third_party/python/Lib/urllib/robotparser.py",
"third_party/python/Lib/uu.py",
"third_party/python/Lib/uuid.py",
"third_party/python/Lib/venv",
"third_party/python/Lib/venv/__init__.py",
"third_party/python/Lib/venv/__main__.py",
"third_party/python/Lib/venv/scripts/common",
"third_party/python/Lib/venv/scripts/common/activate",
"third_party/python/Lib/venv/scripts/nt",
"third_party/python/Lib/venv/scripts/nt/Activate.ps1",
"third_party/python/Lib/venv/scripts/nt/activate.bat",
"third_party/python/Lib/venv/scripts/nt/deactivate.bat",
"third_party/python/Lib/venv/scripts/posix",
"third_party/python/Lib/venv/scripts/posix/activate.csh",
"third_party/python/Lib/venv/scripts/posix/activate.fish",
"third_party/python/Lib/warnings.py",
"third_party/python/Lib/wave.py",
"third_party/python/Lib/weakref.py",
"third_party/python/Lib/webbrowser.py",
"third_party/python/Lib/wsgiref",
"third_party/python/Lib/wsgiref/__init__.py",
"third_party/python/Lib/wsgiref/handlers.py",
"third_party/python/Lib/wsgiref/headers.py",
"third_party/python/Lib/wsgiref/simple_server.py",
"third_party/python/Lib/wsgiref/util.py",
"third_party/python/Lib/wsgiref/validate.py",
"third_party/python/Lib/xdrlib.py",
"third_party/python/Lib/xml",
"third_party/python/Lib/xml/__init__.py",
"third_party/python/Lib/xml/dom",
"third_party/python/Lib/xml/dom/NodeFilter.py",
"third_party/python/Lib/xml/dom/__init__.py",
"third_party/python/Lib/xml/dom/domreg.py",
"third_party/python/Lib/xml/dom/expatbuilder.py",
"third_party/python/Lib/xml/dom/minicompat.py",
"third_party/python/Lib/xml/dom/minidom.py",
"third_party/python/Lib/xml/dom/pulldom.py",
"third_party/python/Lib/xml/dom/xmlbuilder.py",
"third_party/python/Lib/xml/etree",
"third_party/python/Lib/xml/etree/ElementInclude.py",
"third_party/python/Lib/xml/etree/ElementPath.py",
"third_party/python/Lib/xml/etree/ElementTree.py",
"third_party/python/Lib/xml/etree/__init__.py",
"third_party/python/Lib/xml/etree/cElementTree.py",
"third_party/python/Lib/xml/parsers",
"third_party/python/Lib/xml/parsers/__init__.py",
"third_party/python/Lib/xml/parsers/expat.py",
"third_party/python/Lib/xml/sax",
"third_party/python/Lib/xml/sax/__init__.py",
"third_party/python/Lib/xml/sax/_exceptions.py",
"third_party/python/Lib/xml/sax/expatreader.py",
"third_party/python/Lib/xml/sax/handler.py",
"third_party/python/Lib/xml/sax/saxutils.py",
"third_party/python/Lib/xml/sax/xmlreader.py",
"third_party/python/Lib/xmlrpc",
"third_party/python/Lib/xmlrpc/__init__.py",
"third_party/python/Lib/xmlrpc/client.py",
"third_party/python/Lib/xmlrpc/server.py",
"third_party/python/Lib/zipapp.py",
"third_party/python/Lib/zipfile.py",
)
ARTIFACTS = set()
def MakeDirs(d):
if d + "/" not in ARTIFACTS:
ARTIFACTS.add(d + "/")
if d == "third_party/python/Lib":
print()
print("o/$(MODE)/third_party/python/Lib/:\n"
"\t@mkdir -p $@")
print()
print("o/$(MODE)/third_party/python/Lib/.zip.o:\t\\\n"
"\t\to/$(MODE)/third_party/python/Lib/\n"
"\t@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $<")
else:
p = os.path.dirname(d)
MakeDirs(p)
print()
print(("o/$(MODE)/%s/:\t\\\n"
"\t\to/$(MODE)/%s/\n"
"\t@mkdir -p $@") % (d, p))
print()
print(("o/$(MODE)/%s/.zip.o:\t\\\n"
"\t\to/$(MODE)/%s/\n"
"\t@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $<") % (d, d))
for f in SAUCES:
if f.endswith(".py"):
d = "%s/__pycache__" % (os.path.dirname(f))
MakeDirs(d)
b = os.path.basename(f)
c = "%s/%s.cpython-36.pyc" % (d, b[:-3])
print()
print(("o/$(MODE)/%s:\t\\\n"
"\t\t%s\t\\\n"
"\t\to/$(MODE)/%s/\t\\\n"
"\t\t%s\n"
"\t@$(COMPILE) -APYCOMP %s -o $@ $<") % (c, f, d, PYCOMP, PYCOMP))
print()
print(("o/$(MODE)/%s.zip.o:\t\\\n"
"\t\to/$(MODE)/%s\n"
"\t@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $<") % (c, c))
ARTIFACTS.add(c)
elif os.path.isfile(f):
d = os.path.dirname(f)
MakeDirs(d)
b = os.path.basename(f)
c = "%s/%s" % (d, b)
print()
print(("o/$(MODE)/%s:\t\\\n"
"\t\t%s\t\\\n"
"\t\to/$(MODE)/%s/\n"
"\t@cp -f $< $@") % (c, f, d))
print(("o/$(MODE)/%s.zip.o:\t\\\n"
"\t\to/$(MODE)/%s\n"
"\t@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $<") % (c, c))
ARTIFACTS.add(c)
else:
MakeDirs(f)
ARTIFACTS.add(f + "/")
print()
print("THIRD_PARTY_PYTHON_STDLIB_PY_OBJS =\t\\")
print("\t" + "\t\\\n\t".join(sorted("o/$(MODE)/%s.zip.o" % (x) for x in ARTIFACTS)))

173
third_party/python/pycomp.c vendored Normal file
View file

@ -0,0 +1,173 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/stat.h"
#include "libc/fmt/conv.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/o.h"
#include "libc/x/x.h"
#include "third_party/getopt/getopt.h"
#include "third_party/python/Include/bytesobject.h"
#include "third_party/python/Include/compile.h"
#include "third_party/python/Include/fileutils.h"
#include "third_party/python/Include/import.h"
#include "third_party/python/Include/marshal.h"
#include "third_party/python/Include/pydebug.h"
#include "third_party/python/Include/pylifecycle.h"
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/pythonrun.h"
/* clang-format off */
#define MANUAL "\
SYNOPSIS\n\
\n\
pycomp.com [FLAGS] SOURCE\n\
\n\
OVERVIEW\n\
\n\
Python Compiler\n\
\n\
FLAGS\n\
\n\
-o PATH specified output pyc file\n\
-n do nothing\n\
-O optimize\n\
-h help\n\
\n\
EXAMPLE\n\
\n\
pycomp.com -o foo/__pycache__/__init__.cpython-3.6.pyc foo/__init__.py\n\
\n"
PyObject *PyMarshal_Init(void);
PyObject *PyInit_gc(void);
PyObject *PyInit__ast(void);
PyObject *_PyWarnings_Init(void);
PyObject *PyInit__string(void);
struct _inittab _PyImport_Inittab[] = {
{"marshal", PyMarshal_Init},
{"_imp", PyInit_imp},
{"_ast", PyInit__ast},
{"builtins"},
{"sys"},
{"gc", PyInit_gc},
{"_warnings", _PyWarnings_Init},
{"_string", PyInit__string},
{0}
};
const struct _frozen *PyImport_FrozenModules;
const struct _frozen _PyImport_FrozenModules[] = {{0}};
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
char *inpath;
char *outpath;
bool optimize;
void
GetOpts(int argc, char *argv[])
{
int opt;
char *outdir;
while ((opt = getopt(argc, argv, "hnOo:")) != -1) {
switch (opt) {
case 'O':
optimize = true;
break;
case 'o':
outpath = optarg;
break;
case 'n':
exit(0);
case 'h':
fputs(MANUAL, stdout);
exit(0);
default:
fputs(MANUAL, stderr);
exit(1);
}
}
if (argc - optind != 1) {
fputs("error: need one input file\n", stderr);
exit(1);
}
inpath = argv[optind];
if (!outpath) {
outdir = gc(xasprintf("%s/__pycache__", gc(xdirname(inpath))));
mkdir(outdir, 0755);
outpath = xasprintf("%s/%s.cpython-36.pyc", outdir,
gc(xstripexts(basename(inpath))));
}
}
int
main(int argc, char *argv[])
{
int fd;
char *name;
ssize_t rc;
size_t i, n;
struct stat st;
char *s, *p, m[8];
PyObject *code, *marshalled;
GetOpts(argc, argv);
marshalled = 0;
if (stat(inpath, &st) == -1) perror(inpath), exit(1);
CHECK_NOTNULL((p = gc(xslurp(inpath, &n))));
PyImport_FrozenModules = _PyImport_FrozenModules;
Py_NoUserSiteDirectory++;
Py_NoSiteFlag++;
Py_IgnoreEnvironmentFlag++;
Py_FrozenFlag++;
Py_SetProgramName(gc(utf8toutf32(argv[0], -1, 0)));
_Py_InitializeEx_Private(1, 0);
name = gc(xasprintf("zip!%s", inpath));
code = Py_CompileStringExFlags(p, name, Py_file_input, NULL, 0);
if (!code) goto error;
marshalled = PyMarshal_WriteObjectToString(code, Py_MARSHAL_VERSION);
Py_CLEAR(code);
if (!marshalled) goto error;
assert(PyBytes_CheckExact(marshalled));
p = PyBytes_AS_STRING(marshalled);
n = PyBytes_GET_SIZE(marshalled);
CHECK_NE(-1, (fd = open(outpath, O_CREAT|O_TRUNC|O_WRONLY, 0644)));
WRITE16LE(m+0, 3379); /* Python 3.6rc1 */
WRITE16LE(m+2, READ16LE("\r\n"));
WRITE32LE(m+4, st.st_mtim.tv_sec); /* tsk tsk y2038 */
CHECK_EQ(sizeof(m), write(fd, m, sizeof(m)));
for (i = 0; i < n; i += rc) {
CHECK_NE(-1, (rc = write(fd, p + i, n - i)));
}
CHECK_NE(-1, close(fd));
Py_CLEAR(marshalled);
Py_Finalize();
return 0;
error:
PyErr_Print();
Py_Finalize();
if (marshalled) Py_DECREF(marshalled);
return 1;
}

View file

@ -1,5 +1,6 @@
#ifndef Py_PYCONFIG_H #ifndef Py_PYCONFIG_H
#define Py_PYCONFIG_H #define Py_PYCONFIG_H
#include "libc/dce.h"
#include "third_party/zlib/zlib.h" #include "third_party/zlib/zlib.h"
/* Define if building universal (internal helper macro) */ /* Define if building universal (internal helper macro) */
@ -1360,7 +1361,9 @@
/* #undef WITH_NEXT_FRAMEWORK */ /* #undef WITH_NEXT_FRAMEWORK */
/* Define if you want to compile in Python-specific mallocs */ /* Define if you want to compile in Python-specific mallocs */
/* #define WITH_PYMALLOC 1 */ #ifndef __FSANITIZE_ADDRESS__
#define WITH_PYMALLOC 1
#endif
/* Define if you want to compile in rudimentary thread support */ /* Define if you want to compile in rudimentary thread support */
/* #undef WITH_THREAD */ /* #undef WITH_THREAD */

File diff suppressed because it is too large Load diff

View file

@ -306,6 +306,9 @@ THIRD_PARTY_PYTHON_OBJECTS_SRCS = \
third_party/python/Objects/tupleobject.c \ third_party/python/Objects/tupleobject.c \
third_party/python/Objects/typeobject.c \ third_party/python/Objects/typeobject.c \
third_party/python/Objects/unicodectype.c \ third_party/python/Objects/unicodectype.c \
third_party/python/Objects/unicodeislinebreak.c \
third_party/python/Objects/unicodeiswhitespace.c \
third_party/python/Objects/unicodetonumeric.c \
third_party/python/Objects/unicodeobject.c \ third_party/python/Objects/unicodeobject.c \
third_party/python/Objects/weakrefobject.c third_party/python/Objects/weakrefobject.c
@ -389,7 +392,8 @@ THIRD_PARTY_PYTHON_BINS = \
THIRD_PARTY_PYTHON_COMS = \ THIRD_PARTY_PYTHON_COMS = \
o/$(MODE)/third_party/python/python.com \ o/$(MODE)/third_party/python/python.com \
o/$(MODE)/third_party/python/freeze.com o/$(MODE)/third_party/python/freeze.com \
o/$(MODE)/third_party/python/pycomp.com
THIRD_PARTY_PYTHON_A_CHECKS = \ THIRD_PARTY_PYTHON_A_CHECKS = \
$(THIRD_PARTY_PYTHON_A).pkg \ $(THIRD_PARTY_PYTHON_A).pkg \
@ -438,6 +442,19 @@ o/$(MODE)/third_party/python/python.com.dbg: \
$(APE) $(APE)
-@$(APELINK) -@$(APELINK)
o/$(MODE)/third_party/python/pycomp: \
o/$(MODE)/third_party/python/pycomp.com
@cp -f $< $@
@$@ -n
o/$(MODE)/third_party/python/pycomp.com.dbg: \
$(THIRD_PARTY_PYTHON_A_DEPS) \
$(THIRD_PARTY_PYTHON_A) \
o/$(MODE)/third_party/python/pycomp.o \
$(CRT) \
$(APE)
-@$(APELINK)
o/$(MODE)/third_party/python/freeze.com.dbg: \ o/$(MODE)/third_party/python/freeze.com.dbg: \
$(THIRD_PARTY_PYTHON_A_DEPS) \ $(THIRD_PARTY_PYTHON_A_DEPS) \
$(THIRD_PARTY_PYTHON_A) \ $(THIRD_PARTY_PYTHON_A) \

View file

@ -78,7 +78,7 @@ FLAGS\n\
-V NUMBER specifies compiler version\n\ -V NUMBER specifies compiler version\n\
-t touch target on success\n\ -t touch target on success\n\
-n do nothing (used to prime the executable)\n\ -n do nothing (used to prime the executable)\n\
-? print help\n\ -h print help\n\
\n" \n"
struct Args { struct Args {

View file

@ -26,7 +26,6 @@
char *StripComponents(const char *path, int n) { char *StripComponents(const char *path, int n) {
const char *p; const char *p;
while (n-- > 0) { while (n-- > 0) {
while (*path == '/') ++path;
for (p = path; *p; ++p) { for (p = path; *p; ++p) {
if (*p == '/') { if (*p == '/') {
path = p + 1; path = p + 1;