Skip to content

Commit

Permalink
fix for 3.8/3.9 differences
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Aug 13, 2023
1 parent 48d9e62 commit e22633d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 57 deletions.
43 changes: 14 additions & 29 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -64,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 @@ -106,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 Down
43 changes: 16 additions & 27 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 @@ -139,8 +123,13 @@ ls $(pypy -c "from distutils import sysconfig; print(sysconfig.get_config_var('I
_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
pypy -c "import _testcapi"
pypy -c "import _ctypes_test"
pypy -c "import _testmultiphase"
if [[ "${PY_VERSION}" == "3.8" ]]; then
pypy -c "import _ctypes_test"
pypy -c "import _testmultiphase"
else
pypy -c "import _ctypes_test_build"
pypy -c "import _testmultiphase_build"
fi

# Run the python stdlib tests
# no timeout on darwin
Expand Down
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source:
- 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 Down

0 comments on commit e22633d

Please sign in to comment.