diff options
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/buildbot/README.tcltk-AMD64 | 36 | ||||
-rw-r--r-- | Tools/buildbot/build-amd64.bat | 6 | ||||
-rw-r--r-- | Tools/buildbot/build.bat | 18 | ||||
-rw-r--r-- | Tools/buildbot/buildmsi.bat | 15 | ||||
-rw-r--r-- | Tools/buildbot/clean-amd64.bat | 10 | ||||
-rw-r--r-- | Tools/buildbot/clean.bat | 41 | ||||
-rw-r--r-- | Tools/buildbot/external-amd64.bat | 30 | ||||
-rw-r--r-- | Tools/buildbot/external-common.bat | 52 | ||||
-rw-r--r-- | Tools/buildbot/external.bat | 31 | ||||
-rw-r--r-- | Tools/buildbot/test-amd64.bat | 8 | ||||
-rw-r--r-- | Tools/buildbot/test.bat | 8 | ||||
-rwxr-xr-x | Tools/clinic/clinic.py | 17 | ||||
-rwxr-xr-x | Tools/i18n/makelocalealias.py | 62 | ||||
-rw-r--r-- | Tools/msi/msi.py | 4 | ||||
-rw-r--r-- | Tools/parser/unparse.py | 2 | ||||
-rwxr-xr-x | Tools/scripts/diff.py | 34 | ||||
-rw-r--r-- | Tools/scripts/generate_opcode_h.py | 54 | ||||
-rw-r--r-- | Tools/scripts/run_tests.py | 8 | ||||
-rw-r--r-- | Tools/unicode/makeunicodedata.py | 2 |
19 files changed, 220 insertions, 218 deletions
diff --git a/Tools/buildbot/README.tcltk-AMD64 b/Tools/buildbot/README.tcltk-AMD64 deleted file mode 100644 index edc89eb..0000000 --- a/Tools/buildbot/README.tcltk-AMD64 +++ /dev/null @@ -1,36 +0,0 @@ -Comments on building tcl/tk for AMD64 with the MS SDK compiler -============================================================== - -I did have to build tcl/tk manually. - -First, I had to build the nmakehlp.exe helper utility manually by executing - cl nmakehlp.c /link bufferoverflowU.lib -in both the tcl8.4.12\win and tk8.4.12\win directories. - -Second, the AMD64 compiler refuses to compile the file -tcl8.4.12\generic\tclExecute.c because it insists on using intrinsics -for the 'ceil' and 'floor' functions: - - ..\generic\tclExecute.c(394) : error C2099: initializer is not a constant - ..\generic\tclExecute.c(398) : error C2099: initializer is not a constant - -I did comment out these lines; an alternative would have been to use -the /Oi- compiler flag to disable the intrinsic functions. -The commands then used were these: - - svn export http://svn.python.org/projects/external/tcl8.4.12 - cd tcl8.4.12\win - REM - echo patch the tcl8.4.12\generic\tclExecute.c file - pause - REM - cl nmakehlp.c /link bufferoverflowU.lib - nmake -f makefile.vc MACHINE=AMD64 - nmake -f makefile.vc INSTALLDIR=..\..\tcltk install - cd ..\.. - svn export http://svn.python.org/projects/external/tk8.4.12 - cd tk8.4.12\win - cl nmakehlp.c /link bufferoverflowU.lib - nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 MACHINE=AMD64 - nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install - cd ..\.. diff --git a/Tools/buildbot/build-amd64.bat b/Tools/buildbot/build-amd64.bat index 493e74d..115e111 100644 --- a/Tools/buildbot/build-amd64.bat +++ b/Tools/buildbot/build-amd64.bat @@ -1,6 +1,2 @@ @rem Used by the buildbot "compile" step. -cmd /c Tools\buildbot\external-amd64.bat -call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -cmd /c Tools\buildbot\clean-amd64.bat - -msbuild PCbuild\pcbuild.sln /p:Configuration=Debug /p:Platform=x64 +call "%~dp0build.bat" -p x64 %* diff --git a/Tools/buildbot/build.bat b/Tools/buildbot/build.bat index be79b10..d37ec7b 100644 --- a/Tools/buildbot/build.bat +++ b/Tools/buildbot/build.bat @@ -1,7 +1,17 @@ @rem Used by the buildbot "compile" step. -cmd /c Tools\buildbot\external.bat -call "%VS100COMNTOOLS%vsvars32.bat" -cmd /c Tools\buildbot\clean.bat -msbuild PCbuild\pcbuild.sln /p:Configuration=Debug /p:Platform=Win32 +@rem Clean up +call "%~dp0clean.bat" +@rem If you need the buildbots to start fresh (such as when upgrading to +@rem a new version of an external library, especially Tcl/Tk): +@rem 1) uncomment the following line: + +@rem call "%~dp0..\..\PCbuild\get_externals.bat" --clean-only + +@rem 2) commit and push +@rem 3) wait for all Windows bots to start a build with that changeset +@rem 4) re-comment, commit and push again + +@rem Do the build +call "%~dp0..\..\PCbuild\build.bat" -e -d %* diff --git a/Tools/buildbot/buildmsi.bat b/Tools/buildbot/buildmsi.bat index ae93e67..f414c22 100644 --- a/Tools/buildbot/buildmsi.bat +++ b/Tools/buildbot/buildmsi.bat @@ -1,21 +1,20 @@ @rem Used by the buildbot "buildmsi" step. +setlocal -cmd /c Tools\buildbot\external.bat +set cwd=%CD% @rem build release versions of things -call "%VS100COMNTOOLS%vsvars32.bat" - -@rem build Python -msbuild /p:useenv=true PCbuild\pcbuild.sln /p:Configuration=Release /p:Platform=Win32 +call "%~dp0build.bat" -c Release @rem build the documentation -bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp' -"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp +call "%~dp0..\..\Doc\make.bat" htmlhelp @rem build the MSI file -cd PC +call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" x86 +cd "%~dp0..\..\PC" nmake /f icons.mak cd ..\Tools\msi del *.msi nmake /f msisupport.mak %HOST_PYTHON% msi.py +cd "%cwd%" diff --git a/Tools/buildbot/clean-amd64.bat b/Tools/buildbot/clean-amd64.bat index 24660af..b4882c2 100644 --- a/Tools/buildbot/clean-amd64.bat +++ b/Tools/buildbot/clean-amd64.bat @@ -1,10 +1,2 @@ @rem Used by the buildbot "clean" step. -call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -@echo Deleting .pyc/.pyo files ... -del /s Lib\*.pyc Lib\*.pyo -@echo Deleting test leftovers ... -rmdir /s /q build -cd PCbuild -msbuild /target:clean pcbuild.sln /p:Configuration=Release /p:PlatformTarget=x64 -msbuild /target:clean pcbuild.sln /p:Configuration=Debug /p:PlatformTarget=x64 -cd .. +@call "%~dp0clean.bat" x64 diff --git a/Tools/buildbot/clean.bat b/Tools/buildbot/clean.bat index 218facc..f4643a8 100644 --- a/Tools/buildbot/clean.bat +++ b/Tools/buildbot/clean.bat @@ -1,8 +1,33 @@ -@rem Used by the buildbot "clean" step. -call "%VS100COMNTOOLS%vsvars32.bat" -@echo Deleting test leftovers ... -rmdir /s /q build -cd PCbuild -msbuild /target:clean pcbuild.sln /p:Configuration=Release /p:PlatformTarget=x86 -msbuild /target:clean pcbuild.sln /p:Configuration=Debug /p:PlatformTarget=x86 -cd .. +@echo off +rem Used by the buildbot "clean" step. + +setlocal +set root=%~dp0..\.. +set pcbuild=%root%\PCbuild + +echo.Attempting to kill Pythons... +for %%k in (kill_python.exe + kill_python_d.exe + amd64\kill_python.exe + amd64\kill_python_d.exe + ) do ( + if exist "%pcbuild%\%%k" ( + echo.Calling %pcbuild%\%%k... + "%pcbuild%\%%k" + ) +) +if "%1" == "x64" ( + set vcvars_target=x86_amd64 + set platform_target=x64 +) else ( + set vcvars_target=x86 + set platform_target=x86 +) +call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" %vcvars_target% +echo Deleting .pyc/.pyo files ... +del /s "%root%\Lib\*.pyc" "%root%\Lib\*.pyo" +echo Deleting test leftovers ... +rmdir /s /q "%root%\build" + +msbuild /target:clean "%pcbuild%\pcbuild.sln" /p:Configuration=Release /p:PlatformTarget=%platform_target% +msbuild /target:clean "%pcbuild%\pcbuild.sln" /p:Configuration=Debug /p:PlatformTarget=%platform_target% diff --git a/Tools/buildbot/external-amd64.bat b/Tools/buildbot/external-amd64.bat index acd454e..7a570d9 100644 --- a/Tools/buildbot/external-amd64.bat +++ b/Tools/buildbot/external-amd64.bat @@ -1,28 +1,2 @@ -@rem Fetches (and builds if necessary) external dependencies - -@rem Assume we start inside the Python source directory -call "Tools\buildbot\external-common.bat" -call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 - -if not exist tcltk64\bin\tcl86tg.dll ( - cd tcl-8.6.1.0\win - nmake -f makefile.vc OPTS=symbols MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean core shell dlls - nmake -f makefile.vc OPTS=symbols MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install-binaries install-libraries - cd ..\.. -) - -if not exist tcltk64\bin\tk86tg.dll ( - cd tk-8.6.1.0\win - nmake -f makefile.vc OPTS=symbols MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.6.1.0 clean - nmake -f makefile.vc OPTS=symbols MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.6.1.0 all - nmake -f makefile.vc OPTS=symbols MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.6.1.0 install-binaries install-libraries - cd ..\.. -) - -if not exist tcltk64\lib\tix8.4.3\tix84g.dll ( - cd tix-8.4.3.4\win - nmake -f python.mak DEBUG=1 MACHINE=AMD64 TCL_DIR=..\..\tcl-8.6.1.0 TK_DIR=..\..\tk-8.6.1.0 INSTALL_DIR=..\..\tcltk64 clean - nmake -f python.mak DEBUG=1 MACHINE=AMD64 TCL_DIR=..\..\tcl-8.6.1.0 TK_DIR=..\..\tk-8.6.1.0 INSTALL_DIR=..\..\tcltk64 all - nmake -f python.mak DEBUG=1 MACHINE=AMD64 TCL_DIR=..\..\tcl-8.6.1.0 TK_DIR=..\..\tk-8.6.1.0 INSTALL_DIR=..\..\tcltk64 install - cd ..\.. -) +@echo Please use PCbuild\get_externals.bat instead. +@"%~dp0..\..\PCbuild\get_externals.bat" %* diff --git a/Tools/buildbot/external-common.bat b/Tools/buildbot/external-common.bat deleted file mode 100644 index 215a4b9..0000000 --- a/Tools/buildbot/external-common.bat +++ /dev/null @@ -1,52 +0,0 @@ -@rem Common file shared between external.bat and external-amd64.bat. Responsible for -@rem fetching external components into the root\.. buildbot directories. - -if not exist externals mkdir externals -cd externals -@rem XXX: If you need to force the buildbots to start from a fresh environment, uncomment -@rem the following, check it in, then check it out, comment it out, then check it back in. -@rem if exist bzip2-1.0.6 rd /s/q bzip2-1.0.6 -@rem if exist tcltk rd /s/q tcltk -@rem if exist tcltk64 rd /s/q tcltk64 -@rem if exist tcl-8.6.1.0 rd /s/q tcl-8.6.1.0 -@rem if exist tk-8.6.1.0 rd /s/q tk-8.6.1.0 -@rem if exist tix-8.4.3.4 rd /s/q tix-8.4.3.4 -@rem if exist db-4.4.20 rd /s/q db-4.4.20 -@rem if exist openssl-1.0.1j rd /s/q openssl-1.0.1j -@rem if exist sqlite-3.7.12 rd /s/q sqlite-3.7.12 - -@rem bzip -if not exist bzip2-1.0.6 ( - rd /s/q bzip2-1.0.5 - svn export http://svn.python.org/projects/external/bzip2-1.0.6 -) - -@rem NASM, for OpenSSL build -@rem if exist nasm-2.11.06 rd /s/q nasm-2.11.06 -if not exist nasm-2.11.06 svn export http://svn.python.org/projects/external/nasm-2.11.06 - -@rem OpenSSL -if not exist openssl-1.0.1j ( - rd /s/q openssl-1.0.1i - svn export http://svn.python.org/projects/external/openssl-1.0.1j -) - -@rem tcl/tk -if not exist tcl-8.6.1.0 ( - rd /s/q tcltk tcltk64 tcl-8.5.11.0 tk-8.5.11.0 - svn export http://svn.python.org/projects/external/tcl-8.6.1.0 -) -if not exist tk-8.6.1.0 svn export http://svn.python.org/projects/external/tk-8.6.1.0 -if not exist tix-8.4.3.4 svn export http://svn.python.org/projects/external/tix-8.4.3.4 - -@rem sqlite3 -if not exist sqlite-3.8.3.1 ( - rd /s/q sqlite-source-3.8.1 - svn export http://svn.python.org/projects/external/sqlite-3.8.3.1 -) - -@rem lzma -if not exist xz-5.0.5 ( - rd /s/q xz-5.0.3 - svn export http://svn.python.org/projects/external/xz-5.0.5 -) diff --git a/Tools/buildbot/external.bat b/Tools/buildbot/external.bat index 3877d8d..7a570d9 100644 --- a/Tools/buildbot/external.bat +++ b/Tools/buildbot/external.bat @@ -1,29 +1,2 @@ -@rem Fetches (and builds if necessary) external dependencies - -@rem Assume we start inside the Python source directory -call "Tools\buildbot\external-common.bat" -call "%VS100COMNTOOLS%\vsvars32.bat" - -if not exist tcltk\bin\tcl86tg.dll ( - @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install - cd tcl-8.6.1.0\win - nmake -f makefile.vc OPTS=symbols INSTALLDIR=..\..\tcltk clean core shell dlls - nmake -f makefile.vc OPTS=symbols INSTALLDIR=..\..\tcltk install-binaries install-libraries - cd ..\.. -) - -if not exist tcltk\bin\tk86tg.dll ( - cd tk-8.6.1.0\win - nmake -f makefile.vc OPTS=symbols INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.6.1.0 clean - nmake -f makefile.vc OPTS=symbols INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.6.1.0 all - nmake -f makefile.vc OPTS=symbols INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.6.1.0 install-binaries install-libraries - cd ..\.. -) - -if not exist tcltk\lib\tix8.4.3\tix84g.dll ( - cd tix-8.4.3.4\win - nmake -f python.mak DEBUG=1 MACHINE=IX86 TCL_DIR=..\..\tcl-8.6.1.0 TK_DIR=..\..\tk-8.6.1.0 INSTALL_DIR=..\..\tcltk clean - nmake -f python.mak DEBUG=1 MACHINE=IX86 TCL_DIR=..\..\tcl-8.6.1.0 TK_DIR=..\..\tk-8.6.1.0 INSTALL_DIR=..\..\tcltk all - nmake -f python.mak DEBUG=1 MACHINE=IX86 TCL_DIR=..\..\tcl-8.6.1.0 TK_DIR=..\..\tk-8.6.1.0 INSTALL_DIR=..\..\tcltk install - cd ..\.. -) +@echo Please use PCbuild\get_externals.bat instead. +@"%~dp0..\..\PCbuild\get_externals.bat" %* diff --git a/Tools/buildbot/test-amd64.bat b/Tools/buildbot/test-amd64.bat index de64f25..7a241f5 100644 --- a/Tools/buildbot/test-amd64.bat +++ b/Tools/buildbot/test-amd64.bat @@ -1,3 +1,7 @@ @rem Used by the buildbot "test" step. -cd PCbuild -call rt.bat -d -q -x64 -uall -rwW -n --timeout=3600 %1 %2 %3 %4 %5 %6 %7 %8 %9 + +setlocal +rem The following line should be removed before #20035 is closed +set TCL_LIBRARY=%~dp0..\..\externals\tcltk64\lib\tcl8.6 + +call "%~dp0..\..\PCbuild\rt.bat" -d -q -x64 -uall -rwW -n --timeout=3600 %* diff --git a/Tools/buildbot/test.bat b/Tools/buildbot/test.bat index 4e4db10..6a6448c 100644 --- a/Tools/buildbot/test.bat +++ b/Tools/buildbot/test.bat @@ -1,3 +1,7 @@ @rem Used by the buildbot "test" step. -cd PCbuild -call rt.bat -d -q -uall -rwW -n --timeout=3600 %1 %2 %3 %4 %5 %6 %7 %8 %9 + +setlocal +rem The following line should be removed before #20035 is closed +set TCL_LIBRARY=%~dp0..\..\externals\tcltk\lib\tcl8.6 + +call "%~dp0..\..\PCbuild\rt.bat" -d -q -uall -rwW -n --timeout=3600 %* diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 65bad51..ee663e8 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -1252,10 +1252,11 @@ class BlockParser: match = self.start_re.match(line.lstrip()) return match.group(1) if match else None - def _line(self): + def _line(self, lookahead=False): self.line_number += 1 line = self.input.pop() - self.language.parse_line(line) + if not lookahead: + self.language.parse_line(line) return line def parse_verbatim_block(self): @@ -1311,7 +1312,7 @@ class BlockParser: output_add, output_output = text_accumulator() arguments = None while self.input: - line = self._line() + line = self._line(lookahead=True) match = checksum_re.match(line.lstrip()) arguments = match.group(1) if match else None if arguments: @@ -2425,11 +2426,13 @@ class int_converter(CConverter): format_unit = 'i' c_ignored_default = "0" - def converter_init(self, *, types='int'): + def converter_init(self, *, types='int', type=None): if types == 'str': self.format_unit = 'C' elif types != 'int': fail("int_converter: illegal 'types' argument") + if type != None: + self.type = type class unsigned_int_converter(CConverter): type = 'unsigned int' @@ -2864,10 +2867,11 @@ class long_return_converter(CReturnConverter): type = 'long' conversion_fn = 'PyLong_FromLong' cast = '' + unsigned_cast = '' def render(self, function, data): self.declare(data) - self.err_occurred_if("_return_value == -1", data) + self.err_occurred_if("_return_value == {}-1".format(self.unsigned_cast), data) data.return_conversion.append( ''.join(('return_value = ', self.conversion_fn, '(', self.cast, '_return_value);\n'))) @@ -2888,10 +2892,12 @@ class init_return_converter(long_return_converter): class unsigned_long_return_converter(long_return_converter): type = 'unsigned long' conversion_fn = 'PyLong_FromUnsignedLong' + unsigned_cast = '(unsigned long)' class unsigned_int_return_converter(unsigned_long_return_converter): type = 'unsigned int' cast = '(unsigned long)' + unsigned_cast = '(unsigned int)' class Py_ssize_t_return_converter(long_return_converter): type = 'Py_ssize_t' @@ -2900,6 +2906,7 @@ class Py_ssize_t_return_converter(long_return_converter): class size_t_return_converter(long_return_converter): type = 'size_t' conversion_fn = 'PyLong_FromSize_t' + unsigned_cast = '(size_t)' class double_return_converter(CReturnConverter): diff --git a/Tools/i18n/makelocalealias.py b/Tools/i18n/makelocalealias.py index 10887ce..c7ecace 100755 --- a/Tools/i18n/makelocalealias.py +++ b/Tools/i18n/makelocalealias.py @@ -8,9 +8,12 @@ """ import locale import sys +_locale = locale -# Location of the alias file +# Location of the X11 alias file. LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias' +# Location of the glibc SUPPORTED locales file. +SUPPORTED = '/usr/share/i18n/SUPPORTED' def parse(filename): @@ -44,10 +47,39 @@ def parse(filename): encoding = encoding.replace('-', '') encoding = encoding.replace('_', '') locale = lang + '.' + encoding - if encoding.lower() == 'utf8': - # Ignore UTF-8 mappings - this encoding should be - # available for all locales - continue + data[locale] = alias + return data + +def parse_glibc_supported(filename): + + with open(filename, encoding='latin1') as f: + lines = list(f) + data = {} + for line in lines: + line = line.strip() + if not line: + continue + if line[:1] == '#': + continue + line = line.replace('/', ' ').strip() + line = line.rstrip('\\').rstrip() + words = line.split() + if len(words) != 2: + continue + alias, alias_encoding = words + # Lower-case locale + locale = alias.lower() + # Normalize encoding, if given + if '.' in locale: + lang, encoding = locale.split('.')[:2] + encoding = encoding.replace('-', '') + encoding = encoding.replace('_', '') + locale = lang + '.' + encoding + # Add an encoding to alias + alias, _, modifier = alias.partition('@') + alias = _locale._replace_encoding(alias, alias_encoding) + if modifier and not (modifier == 'euro' and alias_encoding == 'ISO-8859-15'): + alias += '@' + modifier data[locale] = alias return data @@ -92,9 +124,25 @@ def check(data): return errors if __name__ == '__main__': + import argparse + parser = argparse.ArgumentParser() + parser.add_argument('--locale-alias', default=LOCALE_ALIAS, + help='location of the X11 alias file ' + '(default: %a)' % LOCALE_ALIAS) + parser.add_argument('--glibc-supported', default=SUPPORTED, + help='location of the glibc SUPPORTED locales file ' + '(default: %a)' % SUPPORTED) + args = parser.parse_args() + data = locale.locale_alias.copy() - data.update(parse(LOCALE_ALIAS)) - data = optimize(data) + data.update(parse_glibc_supported(args.glibc_supported)) + data.update(parse(args.locale_alias)) + while True: + # Repeat optimization while the size is decreased. + n = len(data) + data = optimize(data) + if len(data) == n: + break print_differences(data, locale.locale_alias) print() print('locale_alias = {') diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py index b48f09a..6616613 100644 --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -925,8 +925,8 @@ def generate_license(): shutil.copyfileobj(open("crtlicense.txt"), out) for name, pat, file in (("bzip2","bzip2-*", "LICENSE"), ("openssl", "openssl-*", "LICENSE"), - ("Tcl", "tcl8*", "license.terms"), - ("Tk", "tk8*", "license.terms"), + ("Tcl", "tcl-8*", "license.terms"), + ("Tk", "tk-8*", "license.terms"), ("Tix", "tix-*", "license.terms")): out.write("\nThis copy of Python includes a copy of %s, which is licensed under the following terms:\n\n" % name) dirs = glob.glob(srcdir+"/../"+pat) diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py index 837cd81..258c648 100644 --- a/Tools/parser/unparse.py +++ b/Tools/parser/unparse.py @@ -401,7 +401,7 @@ class Unparser: self.dispatch(t.operand) self.write(")") - binop = { "Add":"+", "Sub":"-", "Mult":"*", "Div":"/", "Mod":"%", + binop = { "Add":"+", "Sub":"-", "Mult":"*", "MatMult":"@", "Div":"/", "Mod":"%", "LShift":"<<", "RShift":">>", "BitOr":"|", "BitXor":"^", "BitAnd":"&", "FloorDiv":"//", "Pow": "**"} def _BinOp(self, t): diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py index 8be527f..9720a43 100755 --- a/Tools/scripts/diff.py +++ b/Tools/scripts/diff.py @@ -8,7 +8,7 @@ """ -import sys, os, time, difflib, optparse +import sys, os, time, difflib, argparse from datetime import datetime, timezone def file_mtime(path): @@ -18,23 +18,25 @@ def file_mtime(path): def main(): - usage = "usage: %prog [options] fromfile tofile" - parser = optparse.OptionParser(usage) - parser.add_option("-c", action="store_true", default=False, help='Produce a context format diff (default)') - parser.add_option("-u", action="store_true", default=False, help='Produce a unified format diff') - parser.add_option("-m", action="store_true", default=False, help='Produce HTML side by side diff (can use -c and -l in conjunction)') - parser.add_option("-n", action="store_true", default=False, help='Produce a ndiff format diff') - parser.add_option("-l", "--lines", type="int", default=3, help='Set number of context lines (default 3)') - (options, args) = parser.parse_args() - - if len(args) == 0: - parser.print_help() - sys.exit(1) - if len(args) != 2: - parser.error("need to specify both a fromfile and tofile") + parser = argparse.ArgumentParser() + parser.add_argument('-c', action='store_true', default=False, + help='Produce a context format diff (default)') + parser.add_argument('-u', action='store_true', default=False, + help='Produce a unified format diff') + parser.add_argument('-m', action='store_true', default=False, + help='Produce HTML side by side diff ' + '(can use -c and -l in conjunction)') + parser.add_argument('-n', action='store_true', default=False, + help='Produce a ndiff format diff') + parser.add_argument('-l', '--lines', type=int, default=3, + help='Set number of context lines (default 3)') + parser.add_argument('fromfile') + parser.add_argument('tofile') + options = parser.parse_args() n = options.lines - fromfile, tofile = args + fromfile = options.fromfile + tofile = options.tofile fromdate = file_mtime(fromfile) todate = file_mtime(tofile) diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py new file mode 100644 index 0000000..efa18a1 --- /dev/null +++ b/Tools/scripts/generate_opcode_h.py @@ -0,0 +1,54 @@ +# This script generates the opcode.h header file. + +from __future__ import with_statement + +import sys +header = """/* Auto-generated by Tools/scripts/generate_opcode_h.py */ +#ifndef Py_OPCODE_H +#define Py_OPCODE_H +#ifdef __cplusplus +extern "C" { +#endif + + + /* Instruction opcodes for compiled code */ +""" + +footer = """ +/* EXCEPT_HANDLER is a special, implicit block type which is created when + entering an except handler. It is not an opcode but we define it here + as we want it to be available to both frameobject.c and ceval.c, while + remaining private.*/ +#define EXCEPT_HANDLER 257 + + +enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, + PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN, + PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; + +#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OPCODE_H */ +""" + + +def main(opcode_py, outfile='Include/opcode.h'): + opcode = {} + exec(open(opcode_py).read(), opcode) + opmap = opcode['opmap'] + with open(outfile, 'w') as fobj: + fobj.write(header) + for name in opcode['opname']: + if name in opmap: + fobj.write("#define %-20s\t%-3s\n" % (name, opmap[name])) + if name == 'POP_EXCEPT': # Special entry for HAVE_ARGUMENT + fobj.write("#define %-20s\t%-3d\n" % + ('HAVE_ARGUMENT', opcode['HAVE_ARGUMENT'])) + fobj.write(footer) + + +if __name__ == '__main__': + main(sys.argv[1], sys.argv[2]) diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py index a6c5da3..b582e13 100644 --- a/Tools/scripts/run_tests.py +++ b/Tools/scripts/run_tests.py @@ -33,8 +33,6 @@ def main(regrtest_args): # Allow user-specified interpreter options to override our defaults. args.extend(test.support.args_from_interpreter_flags()) - # Workaround for issue #20355 - os.environ.pop("PYTHONWARNINGS", None) # Workaround for issue #20361 args.extend(['-W', 'error::BytesWarning']) @@ -50,7 +48,11 @@ def main(regrtest_args): args.extend(['-u', 'all,-largefile,-audio,-gui']) args.extend(regrtest_args) print(' '.join(args)) - os.execv(sys.executable, args) + if sys.platform == 'win32': + from subprocess import call + sys.exit(call(args)) + else: + os.execv(sys.executable, args) if __name__ == '__main__': diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py index 7636a95..b7d31e8 100644 --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -42,7 +42,7 @@ VERSION = "3.2" # * Doc/library/stdtypes.rst, and # * Doc/library/unicodedata.rst # * Doc/reference/lexical_analysis.rst (two occurrences) -UNIDATA_VERSION = "6.3.0" +UNIDATA_VERSION = "7.0.0" UNICODE_DATA = "UnicodeData%s.txt" COMPOSITION_EXCLUSIONS = "CompositionExclusions%s.txt" EASTASIAN_WIDTH = "EastAsianWidth%s.txt" |