summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
stat options
Period:
Authors:

Commits per author per week (path 'Lib/pathlib.py')

AuthorW08 2026W09 2026W10 2026W11 2026Total
Total00000
nvironment", initenvironment}, {"imageop", initimageop}, {"math", initmath}, @@ -79,12 +72,10 @@ struct { {"regex", initregex}, {"rgbimg", initrgbimg}, {"rotor", initrotor}, -#ifdef USE_SELECT - {"select", initselect}, -#endif {"signal", initsignal}, #ifdef USE_SOCKET {"_socket", init_socket}, + {"select", initselect}, #endif {"soundex", initsoundex}, {"strop", initstrop}, diff --git a/PC/config.h b/PC/config.h index 3a91490..a6cd6f7 100644 --- a/PC/config.h +++ b/PC/config.h @@ -24,19 +24,23 @@ standard part of the Python distribution. #define HAVE_HYPOT #define DONT_HAVE_SIG_ALARM #define DONT_HAVE_SIG_PAUSE +#define LONG_BIT 32 /* Microsoft C defines _MSC_VER */ #if defined(_MSC_VER) && _MSC_VER > 850 -/* Start of defines for NT using VC++ 2.0 and up */ -#define NT +/* Start of defines for MS_WIN32 using VC++ 2.0 and up */ +#define NT /* NT is obsolete - please use MS_WIN32 instead */ +#define MS_WIN32 +#define MS_WINDOWS #ifdef _M_IX86 #define COMPILER "[MSC 32 bit (Intel)]" #else #define COMPILER "[MSC (Unknown)]" #endif -#define PYTHONPATH "c:\\python\\lib" +#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\win" typedef int pid_t; +#define WORD_BIT 32 #pragma warning(disable:4113) #define hypot _hypot #include @@ -44,6 +48,7 @@ typedef int pid_t; #define HAVE_STRFTIME #define NT_THREADS #define WITH_THREAD +#define _COMPLEX_DEFINED #ifndef NETSCAPE_PI #define USE_SOCKET #endif @@ -53,15 +58,20 @@ typedef int pid_t; #ifdef USE_DL_EXPORT #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE #endif -#endif /* NT */ +#endif /* MS_WIN32 */ #if defined(_MSC_VER) && _MSC_VER <= 850 /* Start of defines for 16-bit Windows using VC++ 1.5 */ #define COMPILER "[MSC 16-bit]" +#ifdef _WINDOWS #define MS_WIN16 -#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\dos_8x3" +#define MS_WINDOWS +#endif +#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\win;c:\\python\\lib\\dos_8x3" #define IMPORT_8x3_NAMES typedef int pid_t; +#define WORD_BIT 16 +#define _COMPLEX_DEFINED #pragma warning(disable:4113) #define memcpy memmove /* memcpy dangerous pointer wrap in Win 3.1 */ #define hypot _hypot @@ -99,13 +109,30 @@ int sscanf(const char *, const char *, ...); /* The Watcom compiler defines __WATCOMC__ */ #ifdef __WATCOMC__ #define COMPILER "[Watcom]" -#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\dos_8x3" +#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\win;c:\\python\\lib\\dos_8x3" #define IMPORT_8x3_NAMES #include #include typedef int mode_t; typedef int uid_t; typedef int gid_t; +typedef int pid_t; +#if defined(__NT__) +#define NT /* NT is obsolete - please use MS_WIN32 instead */ +#define MS_WIN32 +#define MS_WINDOWS +#define NT_THREADS +#define USE_SOCKET +#define WITH_THREAD +#elif defined(__WINDOWS__) +#define MS_WIN16 +#define MS_WINDOWS +#endif +#ifdef M_I386 +#define WORD_BIT 32 +#else +#define WORD_BIT 16 +#endif #define VA_LIST_IS_ARRAY #define HAVE_CLOCK #define HAVE_STRFTIME @@ -117,7 +144,7 @@ typedef int gid_t; /* The Borland compiler defines __BORLANDC__ */ #ifdef __BORLANDC__ #define COMPILER "[Borland]" -#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\dos_8x3" +#define PYTHONPATH "c:\\python\\lib;c:\\python\\lib\\win;c:\\python\\lib\\dos_8x3" #define IMPORT_8x3_NAMES #define HAVE_CLOCK #define HAVE_STRFTIME diff --git a/PC/makesrc.exe b/PC/makesrc.exe new file mode 100644 index 0000000..18bb43e Binary files /dev/null and b/PC/makesrc.exe differ diff --git a/PC/pyth_w31.def b/PC/pyth_w31.def new file mode 100644 index 0000000..4fe063c --- /dev/null +++ b/PC/pyth_w31.def @@ -0,0 +1,5 @@ +NAME +EXETYPE WINDOWS +CODE PRELOAD MOVABLE DISCARDABLE +DATA PRELOAD MOVABLE +HEAPSIZE 4096 diff --git a/PC/python.def b/PC/python.def new file mode 100644 index 0000000..77f26d3 --- /dev/null +++ b/PC/python.def @@ -0,0 +1,231 @@ +EXPORTS + Py_GetCopyright + Py_GetVersion + Py_FindMethod + _PyObject_New + _PyString_Resize + PySys_SetArgv + PyObject_Cmp + PyObject_CallObject + PyObject_CallFunction + PyObject_CallMethod + PyObject_Type + PyObject_Length + PyObject_GetItem + PyObject_SetItem + PyNumber_Check + PyNumber_Add + PyNumber_Subtract + PyNumber_Multiply + PyNumber_Divide + PyNumber_Remainder + PyNumber_Divmod + PyNumber_Power + PyNumber_Negative + PyNumber_Positive + PyNumber_Absolute + PyNumber_Invert + PyNumber_Lshift + PyNumber_Rshift + PyNumber_And + PyNumber_Xor + PyNumber_Or + PyNumber_Int + PyNumber_Long + PyNumber_Float + PySequence_Check + PySequence_Concat + PySequence_Repeat + PySequence_GetItem + PySequence_GetSlice + PySequence_SetItem + PySequence_SetSlice + PySequence_Tuple + PySequence_Count + PySequence_In + PySequence_Index + PyMapping_Check + PyMapping_Length + PyMapping_HasKeyString + PyMapping_HasKey + PyMapping_GetItemString + PyMapping_SetItemString + PyAccess_FromValue + PyAccess_AsValue + PyAccess_SetValue + PyAccess_SetOwner + PyAccess_Clone + PyAccess_HasValue + PyEval_CallObject + PyEval_GetBuiltins + PyEval_GetGlobals + PyEval_GetLocals + PyEval_GetOwner + PyEval_GetFrame + PyEval_GetRestricted + Py_FlushLine + Py_AddPendingCall + Py_MakePendingCalls + PyEval_InitThreads + PyEval_SaveThread + PyEval_RestoreThread + PyArg_GetObject + PyArg_GetLong + PyArg_GetShort + PyArg_GetFloat + PyArg_GetString + PyClass_New + PyInstance_New + PyMethod_New + PyMethod_Function + PyMethod_Self + PyMethod_Class + PyClass_IsSubclass + PyNode_Compile + PyCode_New + PyErr_SetNone + PyErr_SetObject + PyErr_SetString + PyErr_Occurred + PyErr_Clear + PyErr_Fetch + PyErr_Restore + PyErr_BadArgument + PyErr_NoMemory + PyErr_SetFromErrno + PyErr_BadInternalCall + PyErr_CheckSignals + PyEval_EvalCode + PyFile_FromFile + PyFile_FromString + PyFile_SetBufSize + PyFile_AsFile + PyFile_Name + PyFile_GetLine + PyFloat_FromDouble + PyFloat_AsDouble + PyFrame_BlockSetup + PyFrame_BlockPop + PyFrame_LocalsToFast + PyFrame_FastToLocals + PyFunction_New + PyFunction_GetCode + PyFunction_GetGlobals + PyFunction_GetDefaults + PyFunction_SetDefaults + PyGrammar_FindDFA + PyGrammar_LabelRepr + PyGrammar_AddAccelerators + PyImport_GetMagicNumber + PyImport_ExecCodeModule + PyImport_GetModuleDict + PyImport_AddModule + PyImport_ImportModule + PyImport_ReloadModule + PyImport_Cleanup + PyInt_FromLong + PyInt_AsLong + PyOS_InterruptOccurred + PyOS_InitInterrupts + PyList_New + PyList_Size + PyList_GetItem + PyList_SetItem + PyList_Insert + PyList_Append + PyList_GetSlice + PyList_SetSlice + PyList_Sort + PyList_Reverse + PyList_AsTuple + PyLong_FromLong + PyLong_FromDouble + PyLong_AsLong + PyLong_AsDouble + PyLong_FromString + PyDict_New + PyDict_GetItem + PyDict_SetItem + PyDict_DelItem + PyDict_Clear + PyDict_Keys + PyDict_Values + PyDict_Items + PyDict_Size + PyDict_GetItemString + PyDict_SetItemString + PyDict_DelItemString + PyMarshal_WriteLongToFile + PyMarshal_WriteObjectToFile + PyMarshal_ReadLongFromFile + PyMarshal_ReadObjectFromFile + PyMarshal_ReadObjectFromString + PyCFunction_GetFunction + PyCFunction_GetSelf + PyCFunction_GetFlags + PyArg_Parse + PyArg_ParseTuple + Py_BuildValue + Py_VaBuildValue + Py_InitModule4 + PyModule_New + PyModule_GetDict + PyModule_GetName + PyNode_New + PyNode_AddChild + PyNode_Free + PyObject_Print + PyObject_Repr + PyObject_Str + PyObject_Compare + PyObject_GetAttrString + PyObject_SetAttrString + PyObject_HasAttrString + PyObject_GetAttr + PyObject_SetAttr + PyObject_Hash + PyObject_IsTrue + PyCallable_Check + PyParser_ParseString + PyParser_ParseFile + Py_FatalError + Py_Initialize + PyRun_AnyFile + PyRun_SimpleString + PyRun_SimpleFile + PyRun_InteractiveOne + PyRun_InteractiveLoop + PyParser_SimpleParseString + PyParser_SimpleParseFile + PyRun_String + PyRun_File + Py_CompileString + PyErr_Print + Py_AtExit + Py_Exit + Py_Cleanup + PyRange_New + PyString_FromStringAndSize + PyString_FromString + PyString_Size + PyString_AsString + PyString_Concat + PyString_ConcatAndDel + PyString_Format + PyMember_Get + PyMember_Set + PySys_GetObject + PySys_SetObject + PySys_GetFile + PySys_Init + PyToken_OneChar + PyToken_TwoChars + PyTraceBack_Here + PyTraceBack_Fetch + PyTraceBack_Store + PyTraceBack_Print + PyTuple_New + PyTuple_Size + PyTuple_GetItem + PyTuple_SetItem + PyTuple_GetSlice diff --git a/PC/python.mk b/PC/python.mk new file mode 100644 index 0000000..91be0ad --- /dev/null +++ b/PC/python.mk @@ -0,0 +1,5 @@ +project : n:\python\python-1.4b0b\pc\wat_os2\pyth_os2.exe n:\python\python-1& +.4b0b\pc\wat_dos\pyth_dos.exe .SYMBOLIC + +!include n:\python\python-1.4b0b\pc\wat_os2\pyth_os2.mk1 +!include n:\python\python-1.4b0b\pc\wat_dos\pyth_dos.mk1 diff --git a/PC/python.wpj b/PC/python.wpj new file mode 100644 index 0000000..afc8221 --- /dev/null +++ b/PC/python.wpj @@ -0,0 +1,63 @@ +40 +projectIdent +0 +VpeMain +1 +WRect +0 +0 +9920 +8704 +2 +MProject +3 +MCommand +0 +4 +MCommand +0 +2 +5 +WFileName +20 +wat_os2\pyth_os2.tgt +6 +WFileName +20 +wat_dos\pyth_dos.tgt +7 +WVList +2 +8 +VComponent +9 +WRect +832 +256 +5632 +4096 +1 +0 +10 +WFileName +20 +wat_os2\pyth_os2.tgt +0 +0 +11 +VComponent +12 +WRect +0 +0 +5632 +4147 +0 +0 +13 +WFileName +20 +wat_dos\pyth_dos.tgt +0 +0 +11 diff --git a/PC/readme.txt b/PC/readme.txt new file mode 100644 index 0000000..e0c6d4e --- /dev/null +++ b/PC/readme.txt @@ -0,0 +1,106 @@ +Welcome to the "PC" subdirectory of the Python distribution! + + +This "PC" subdirectory contains complete project files to make +several PC ports of Python, as well as all the PC-specific +Python source files. It should be located in the root of the +Python distribution, and there should be directories "Modules", +"Objects", "Python", etc. in the parent directory of this "PC" +subdirectory. + +Be sure to read the documentation in the Python distribution. You +must set the environment variable PYTHONPATH to point to your Python +library directory. This is "../Lib", but you must use an absolute path, +and perhaps copy it somewhere else. Be sure to include the Windows +specific directory "win" too. If you use a DOS FAT file system and +either a DOS or Windows 3.1x Python version, you should also put +../Lib/dos_8x3 on your PYTHONPATH too, since it has DOS 8x3 names +for the standard Python library names. So your autoexec.bat should have: + set PYTHONPATH=.;c:\python\lib;c:\python\lib\win +for Windows NT or + set PYTHONPATH=.;c:\python\lib;c:\python\lib\win;c:\python\lib\dos_8x3 +for DOS or Windows 3.1x (change the path to the correct path). + +There are several add-in modules to build Python programs which use +the native Windows operating environment. The ports here just make +"QuickWin" and DOS Python versions which support a character-mode +(console) environment. Look in www.python.org for Tkinter, PythonWin, +WPY and wxPython. + +To make a Python port, start the Integrated Development Environment +(IDE) of your compiler, and read in the native "project file" +(or makefile) provided. This will enable you to change any source +files or build settings so you can make custom builds. + +config.h An important configuration file specific to PC's. + +config.c The list of C modules to include in the Python PC + version. Manually edit this file to add or + remove Python modules. + +testpy.py A Python test program. Run this to test your + Python port. It should say "all tests OK". + +src A subdirectory used only for VC++ version 1.5 Python + source files. See below. The other compilers do not + use it. They reference the actual distribution + directories instead. + +Watcom C++ Version 10.6 +======================= + +The project file for the Watcom compiler is ./python.wpj. +It will build Watcom versions in the directories wat_*. + +wat_dos A 32-bit extended DOS Python (console-mode) using the + dos4gw DOS extender. Sockets are not included. + +wat_os2 A 32-bit OS/2 Python (console-mode). + Sockets are not included. + + +Microsoft Visual C++ Version 4.0 (32-bit Windows) +================================================= + +The project files are vc40.mdp, vc40.ncb and vc40.mak. They +will NOT work from this PC directory. To use them, first copy +them to the Python distribution directory with this command: + copy vc40.* .. +You may then want to remove them from here to prevent confusion. + +Once the project files are located in the directory just above +this one, start VC++ and read in the project. The targets are built +in the subdirectories vc40_*. + +vc40_dll The Python core built as an NT DLL. + +vc40_nt A Windows NT and 95 Python QuickWin (console-mode) + version of Python including sockets. It is + self-contained, and does not require any DLL's. + + +Microsoft Visual C++ Version 1.5 (16-bit Windows) +================================================= + +Since VC++1.5 does not handle long file names, it is necessary +to run the "makesrc.exe" program in this directory to copy +Python files from the distribution to the directory "src" +with shortened names. Included file names are shortened too. +Do this before you attempt to build Python. + +The "makesrc.exe" program is a native NT program, and you must +have NT, Windows 95 or Win32s to run it. Otherwise you will need +to copy distribution files to src yourself. + +The makefiles are named *.mak and are located in directories +starting with "vc15_". NOTE: When dependencies are scanned +VC++ will create dependencies for directories which are not +used because it fails to evaluate "#define" properly. You +must manaully edit makefiles (*.mak) to remove references to +"sys/" and other bad directories. + +vc15_lib A static Python library. Create this first because is + is required for vc15_w31. + +vc15_w31 A Windows 3.1x Python QuickWin (console-mode) + Python including sockets. Requires vc15_lib. diff --git a/PC/testpy.py b/PC/testpy.py new file mode 100644 index 0000000..c037618 --- /dev/null +++ b/PC/testpy.py @@ -0,0 +1,31 @@ +import sys + +# This is a test module for Python. It looks in the standard +# places for various *.py files. If these are moved, you must +# change this module too. + +try: + import string +except: + print """Could not import the standard "string" module. +Please check your PYTHONPATH environment variable.""" + sys.exit(1) + +try: + import regex_syntax +except: + print """Could not import the standard "regex_syntax" module. If this is +a PC, you should add the dos_8x3 directory to your PYTHONPATH.""" + sys.exit(1) + +import os + +for dir in sys.path: + file = os.path.join(dir, "string.py") + if os.path.isfile(file): + test = os.path.join(dir, "test") + if os.path.isdir(test): + # Add the "test" directory to PYTHONPATH. + sys.path = sys.path + [test] + +import autotest # Standard Python tester. diff --git a/PC/utils/makesrc.c b/PC/utils/makesrc.c new file mode 100755 index 0000000..883b4d8 --- /dev/null +++ b/PC/utils/makesrc.c @@ -0,0 +1,67 @@ +#include +#include +#include + +/* Copy files from source directories to ./src changing +file names and #include names to 8x3 lower case */ + +char *usage = "You must be in the \"pc\" directory.\n"; +char *list[] = {"..\\Include", "..\\Modules", "..\\Objects", "..\\Parser", "..\\Python", ".", 0}; +main() +{ + DIR *dpath; + struct dirent *dir; + int len; + char **plist; + char *pt1, *pt2, *name; + char dest_path[256], src_path[256], buf256[256]; + FILE *fpin, *fpout; + + for (plist = list; *plist; plist++){ + if ((dpath = opendir(*plist)) == NULL){ + printf(usage); + return 1; + } + + while (dir = readdir(dpath)){ + name = dir->d_name; + len = strlen(name); + if (len > 2 && name[len - 2] == '.' && + (name[len - 1] == 'c' || name[len - 1] == 'h')){ + strcpy(buf256, name); + if (len > 10){ + buf256[8] = '.'; + buf256[9] = name[len - 1]; + buf256[10] = 0; + } + strlwr(buf256); + strncpy(src_path, *plist, 256); + strncat(src_path, "\\", 256); + strncat(src_path, name, 256); + strncpy(dest_path, ".\\src\\", 256); + strncat(dest_path, buf256, 256); + printf("Copying %-30s to %s\n", src_path, dest_path); +