Skip to content

Commit

Permalink
Merge pull request #105 from mattip/v7.3.12
Browse files Browse the repository at this point in the history
V7.3.12
  • Loading branch information
mattip authored Aug 29, 2023
2 parents 4166637 + c2e5d62 commit a8ab262
Show file tree
Hide file tree
Showing 16 changed files with 611 additions and 79 deletions.
5 changes: 0 additions & 5 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 20 additions & 31 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ copy /b *.dll %GOAL_DIR%
copy /b *.exe %GOAL_DIR%
REM lib goes elsewhere
copy /b *.lib %PYPY3_SRC_DIR%\libs\python%PY_VERSION_NODOTS%.lib || exit /b 11
REM how big is the lib? It should be about 200k
dir *.lib

cd /d %GOAL_DIR%

Expand All @@ -66,32 +64,11 @@ REM License is packaged separately
del %PREFIX%\LICENSE


if exist %PREFIX%\lib_pypy (
REM Make sure the site-packages dir SP_DIR matches with cpython
REM See patch site-and-sysconfig-conda.patch
mkdir %SP_DIR%
echo Adjusting layout for pre-python3.8
move %PREFIX%\README.rst %PREFIX%\lib_pypy\
move %PREFIX%\site-packages\README %SP_DIR%
rmdir /q /s %PREFIX%\site-packages

REM Use conda tcl/tk installation in Library/lib
rmdir /q /s %PREFIX%\tcl
cd %PREFIX%\lib_pypy
..\pypy3 -m compileall .
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
cd %PREFIX%\lib-python
..\pypy3 -m lib2to3.pgen2.driver 3\lib2to3\Grammar.txt
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
..\pypy3 -m lib2to3.pgen2.driver 3\lib2to3\PatternGrammar.txt
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
) else (
cd %PREFIX%\Lib
..\pypy3 -m lib2to3.pgen2.driver lib2to3\Grammar.txt
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
..\pypy3 -m lib2to3.pgen2.driver lib2to3\PatternGrammar.txt
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
)
cd %PREFIX%\Lib
..\pypy3 -m lib2to3.pgen2.driver lib2to3\Grammar.txt
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
..\pypy3 -m lib2to3.pgen2.driver lib2to3\PatternGrammar.txt
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while compiling &exit /b 11)
rem still in lib-python or Lib

..\pypy3 -m compileall .
Expand All @@ -108,9 +85,15 @@ REM timeout 60m pypy3 -m test --pgo -j%CPU_COUNT% || true;
REM Build the cache for the standard library
pypy -c "import _testcapi"
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while building &exit /b 11)
pypy -c "import _ctypes_test"
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while building &exit /b 11)
pypy -c "import _testmultiphase"
if "%PY_VERSION%" == "3.8" (
pypy -c "import _ctypes_test"
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while building &exit /b 11)
pypy -c "import _testmultiphase"
) else (
pypy -c "import _ctypes_test_build"
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while building &exit /b 11)
pypy -c "import _testmultiphase_build"
)
IF %ERRORLEVEL% NEQ 0 (Echo ERROR while building &exit /b 11)

REM Include a %PREFIX%\Scripts directory in the package. This ensures
Expand All @@ -126,3 +109,9 @@ pypy -m venv destination
destination\Scripts\python -c "import sqlite3"
if errorlevel 1 exit 1
rmdir /q /s destination

REM Copy required DLLs so pypy can be used without activating the environment
REM This would fix issue #101 but did not pass reivew
REM copy /b %PREFIX%\Library\bin\libexpat.dll %PREFIX%
REM copy /b %PREFIX%\Library\bin\libbz2.dll %PREFIX%
REM copy /b %PREFIX%\Library\bin\ffi-8.dll %PREFIX%
49 changes: 21 additions & 28 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,31 +95,15 @@ fi
rm $PREFIX/LICENSE
PY_VERSION=$(echo $PKG_NAME | cut -c 5-)

if [[ -d $PREFIX/lib_pypy ]]; then
# For pypy<3.8, the layout needs to be fixed up.

# Move the generic file name to somewhere that's specific to pypy
mv $PREFIX/README.rst $PREFIX/lib_pypy/
# Make sure the site-packages dir match with cpython
mkdir -p $PREFIX/lib/python${PY_VERSION}/site-packages
mv $PREFIX/site-packages/README $PREFIX/lib/python${PY_VERSION}/site-packages/
rm -rf $PREFIX/site-packages
ln -sf $PREFIX/lib/python${PY_VERSION}/site-packages $PREFIX/site-packages
pushd $PREFIX
pypy -m lib2to3.pgen2.driver lib-python/3/lib2to3/Grammar.txt
pypy -m lib2to3.pgen2.driver lib-python/3/lib2to3/PatternGrammar.txt
popd
else
# Make sure the site-packages dir match with cpython
mkdir -p $PREFIX/lib/python${PY_VERSION}/site-packages
mv $PREFIX/lib/pypy${PY_VERSION}/site-packages/README $PREFIX/lib/python${PY_VERSION}/site-packages/
rm -rf $PREFIX/lib/pypy${PY_VERSION}/site-packages
ln -sf $PREFIX/lib/python${PY_VERSION}/site-packages $PREFIX/lib/pypy${PY_VERSION}/site-packages
pushd $PREFIX
pypy -m lib2to3.pgen2.driver lib/pypy${PY_VERSION}/lib2to3/Grammar.txt
pypy -m lib2to3.pgen2.driver lib/pypy${PY_VERSION}/lib2to3/PatternGrammar.txt
popd
fi
# Make sure the site-packages dir match with cpython
mkdir -p $PREFIX/lib/python${PY_VERSION}/site-packages
mv $PREFIX/lib/pypy${PY_VERSION}/site-packages/README $PREFIX/lib/python${PY_VERSION}/site-packages/
rm -rf $PREFIX/lib/pypy${PY_VERSION}/site-packages
ln -sf $PREFIX/lib/python${PY_VERSION}/site-packages $PREFIX/lib/pypy${PY_VERSION}/site-packages
pushd $PREFIX
pypy -m lib2to3.pgen2.driver lib/pypy${PY_VERSION}/lib2to3/Grammar.txt
pypy -m lib2to3.pgen2.driver lib/pypy${PY_VERSION}/lib2to3/PatternGrammar.txt
popd

# Regenerate the sysconfigdata__*.py file with paths from $PREFIX, at install
# those paths will be replaced with the actual user's paths. The generator
Expand All @@ -137,10 +121,19 @@ echo INCLUDEPY $(pypy -c "from distutils import sysconfig; print(sysconfig.get_c
ls $(pypy -c "from distutils import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")

_PYTHON_SYSCONFIGDATA_NAME=$sysconfigdata_name pypy -c "from distutils import sysconfig; assert sysconfig.get_config_var('HOST_GNU_TYPE') != None"
# Build the c-extension modules for the standard library
# Build the test c-extension modules
# PyPy uses a wrapper for _ctypes_test to trick the import system into getting
# the c-extension from `/tmp`, so we need to copy it into LIB
pypy -c "import _testcapi"
pypy -c "import _ctypes_test"
pypy -c "import _testmultiphase"
cp $(pypy -c "import _testcapi; print(_testcapi.__file__)") $PREFIX/lib/pypy${PY_VERSION}
if [[ "${PY_VERSION}" == "3.8" ]]; then
pypy -c "import _ctypes_test, _testmultiphase"
cp $(pypy -c "import _ctypes_test; print(_ctypes_test.__file__)") $PREFIX/lib/pypy${PY_VERSION}
else
pypy -c "import _ctypes_test_build, _testmultiphase_build"
# Need to import the *build module to properly import the built module from `/tmp`
cp $(pypy -c "import _ctypes_test_build, _ctypes_test; print(_ctypes_test.__file__)") $PREFIX/lib/pypy${PY_VERSION}
fi

# Run the python stdlib tests
# no timeout on darwin
Expand Down
39 changes: 26 additions & 13 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{% if name_suffix is not defined %}
{% set name_suffix = "3.8" %}
{% set name_suffix = "3.9" %}
{% endif %}
{% set name = "pypy" ~ name_suffix %}
{% set version = "7.3.11" %}

package:
name: {{ name }}
version: {{ version }}
version: 7.3.11 # [name_suffix == "3.8"]
version: 7.3.12 # [name_suffix == "3.9"]

source:
- url: https://downloads.python.org/pypy/{{ name }}-v{{ version }}-src.tar.bz2
- folder: pypy3
url: https://downloads.python.org/pypy/{{ name }}-v7.3.11-src.tar.bz2 # [name_suffix == "3.8"]
url: https://downloads.python.org/pypy/{{ name }}-v7.3.12-src.tar.bz2 # [name_suffix == "3.9"]
sha256: 4d6769bfca73734e8666fd70503b7ceb06a6e259110e617331bb3899ca4e6058 # [name_suffix == "3.8"]
sha256: b0f3166fb2a5aadfd5ceb9db5cdd5f7929a0eccca02b4a26c0dae0492f7ca8ea # [name_suffix == "3.9"]
folder: pypy3
sha256: e7a2046c7e6c25fc386abbb5132e92a7cc2491e3935699a946cb5dcbb342c2aa # [name_suffix == "3.9"]
patches:
- patches/fficurses.patch
- patches/tklib_build.patch
- patches/tk_app.patch
- patches/lzma_build.patch # [win]
- patches/clibffi.patch # [osx]
- patches/darwin.patch # [osx]
- patches/darwin.patch # [osx and name_suffix == "3.8"]
- patches/0001-Add-conda-forge-version.patch
- patches/0021-Adapt-platform-to-patch-0001.patch
- patches/0023a-Fix-LIBDIR.patch # [name_suffix=="3.8"]
Expand All @@ -32,17 +33,29 @@ source:
- patches/0014-Add-CondaEcosystemModifyDllSearchPath.patch
- patches/0020-Use-ranlib-from-env-if-env-variable-is-set.patch
- patches/0024-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch
# Patches to be removed for the next version
- patches/0019-Disable-copying-dlls.patch
- patches/0020-Use-private-attribute-in-datetime_delta.patch
- patches/0031-Fix-pthread_t-casting.patch
# Patches for 3.8 only
- patches/0019-Disable-copying-dlls.patch # [name_suffix == "3.8"]
- patches/0020-Use-private-attribute-in-datetime_delta.patch # [name_suffix == "3.8"]
- patches/0031-Fix-pthread_t-casting.patch # [name_suffix == "3.8"]
# Patches after 7.3.12
- patches/pypy_107654.patch
- patches/pypy_107655.patch
- patches/pypy_107656.patch
- patches/pypy_107657.patch
- patches/pypy_107658.patch
- patches/pypy_107659.patch # [name_suffix == "3.9"]
- patches/pypy_107663.patch # [name_suffix == "3.8"]
- patches/pypy_107660.patch # [name_suffix == "3.9"]
- patches/pypy_107661.patch
- patches/pypy_107668.patch # [name_suffix == "3.9"]


- url: https://downloads.python.org/pypy/pypy2.7-v7.3.6-win64.zip # [win]
sha256: fcc8f6b3b472a77eaa754951f288fe234b4953bfba845888dd839b9b862cb891 # [win]
folder: pypy2-binary # [win]

build:
number: 1
number: 2
skip_compile_pyc:
- lib*

Expand Down Expand Up @@ -86,7 +99,7 @@ requirements:
- pypy3.7 ==99999999999
- pypy3.8 ==99999999999 # [name_suffix=="3.9"]
- pypy3.9 ==99999999999 # [name_suffix=="3.8"]
- python {{ name_suffix }}.* *_{{ "".join(version.split(".")[:2]) }}_pypy
- python {{ name_suffix }}.* *_7.3_pypy

test:
commands:
Expand Down
66 changes: 66 additions & 0 deletions recipe/patches/pypy_107654.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# HG changeset patch
# User Carl Friedrich Bolz-Tereick <[email protected]>
# Date 1689079860 -7200
# Tue Jul 11 14:51:00 2023 +0200
# Branch conda-3.9-v7.3.12
# Node ID 163544ab2a142b8e7e040a098ec9013963c9fb64
# Parent 3f3f2298ddc56db44bbdb4551ce992d8e9401646
#3961: don't uselessly compile a regex for *every* parsed email message. the
pattern is anyway always the same, apart from a variable prefix. Instead, first
check the prefix with str.startswith, and only if that returns True, match the
rest of the regular expression.

diff -r 3f3f2298ddc5 -r 163544ab2a14 lib-python/3/email/feedparser.py
--- a/lib-python/3/email/feedparser.py Thu Jun 15 12:31:24 2023 +0300
+++ b/lib-python/3/email/feedparser.py Tue Jul 11 14:51:00 2023 +0200
@@ -37,6 +37,7 @@
headerRE = re.compile(r'^(From |[\041-\071\073-\176]*:|[\t ])')
EMPTYSTRING = ''
NL = '\n'
+boundaryend_re = re.compile(r'(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$')

NeedMoreData = object()

@@ -329,9 +330,14 @@
# this onto the input stream until we've scanned past the
# preamble.
separator = '--' + boundary
- boundaryre = re.compile(
- '(?P<sep>' + re.escape(separator) +
- r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$')
+ # PyPy difference: don't compile a new regular expression for every
+ # single message, instead just use str.startswith and a generic re
+ # this prevents the JIT compiling more and more traces for all the
+ # different (random) boundaries of messages
+ def boundarymatch(line):
+ if not line.startswith(separator):
+ return None
+ return boundaryend_re.match(line, len(separator))
capturing_preamble = True
preamble = []
linesep = False
@@ -343,7 +349,7 @@
continue
if line == '':
break
- mo = boundaryre.match(line)
+ mo = boundarymatch(line)
if mo:
# If we're looking at the end boundary, we're done with
# this multipart. If there was a newline at the end of
@@ -375,13 +381,13 @@
if line is NeedMoreData:
yield NeedMoreData
continue
- mo = boundaryre.match(line)
+ mo = boundarymatch(line)
if not mo:
self._input.unreadline(line)
break
# Recurse to parse this subpart; the input stream points
# at the subpart's first line.
- self._input.push_eof_matcher(boundaryre.match)
+ self._input.push_eof_matcher(boundarymatch)
for retval in self._parsegen():
if retval is NeedMoreData:
yield NeedMoreData
40 changes: 40 additions & 0 deletions recipe/patches/pypy_107655.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# HG changeset patch
# User Carl Friedrich Bolz-Tereick <[email protected]>
# Date 1689148718 -7200
# Wed Jul 12 09:58:38 2023 +0200
# Branch conda-3.9-v7.3.12
# Node ID f371f05be18aedeeb966fd9b657e72a7dbbc5126
# Parent 163544ab2a142b8e7e040a098ec9013963c9fb64
#3961: precompile res in csv module

diff -r 163544ab2a14 -r f371f05be18a lib-python/3/csv.py
--- a/lib-python/3/csv.py Tue Jul 11 14:51:00 2023 +0200
+++ b/lib-python/3/csv.py Wed Jul 12 09:58:38 2023 +0200
@@ -162,6 +162,12 @@
except NameError:
complex = float

+_SNIFFER_RES = [re.compile(restr, re.DOTALL | re.MULTILINE) for restr in
+ (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
+ r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
+ r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)', # ,".*?"
+ r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)')] # ".*?" (no delim, no space)
+
class Sniffer:
'''
"Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
@@ -214,11 +220,9 @@
"""

matches = []
- for restr in (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
- r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
- r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)', # ,".*?"
- r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space)
- regexp = re.compile(restr, re.DOTALL | re.MULTILINE)
+ # PyPy difference: compile the regular expressions only once, globally,
+ # instead of on every call to sniff
+ for regexp in _SNIFFER_RES:
matches = regexp.findall(data)
if matches:
break
Loading

0 comments on commit a8ab262

Please sign in to comment.