From 41e61fdc13472a1037b2014a2d987456eed67aa5 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 11 Mar 2024 15:12:14 +0300 Subject: [PATCH] Drop gmpy2 directory & move source files to src/gmpy2/ This uses more modern directory layout (like the ``python-flint`` does, for example) and avoids extra pure-python code while doing import. The drawback is that you have to use extra ``--follow`` arguments for some ``git`` commands (e.g. ``git log``) to access early history. With this patch: ``` $ time python -c 'from gmpy2 import *' real 0m0.065s user 0m0.050s sys 0m0.015s ``` On the master: ``` $ time python -c 'from gmpy2 import *' real 0m0.120s user 0m0.095s sys 0m0.024s ``` Uses patched delocate from my repo: git+https://github.com/skirpichev/delocate.git@fix-lib-sdir --- .github/workflows/pip_install_gmpy2.yml | 8 ++++---- gmpy2/__init__.pxd | 1 - gmpy2/__init__.py | 10 ---------- gmpy2/gmpy2.h | 1 - gmpy2/gmpy2.pxd | 1 - pyproject.toml | 10 ++++++---- scripts/cibw_before_all.sh | 2 +- scripts/cibw_repair_wheel_command.sh | 3 ++- setup.py | 4 ++-- src/{ => gmpy2}/gmpy2.c | 0 src/{ => gmpy2}/gmpy2.h | 0 src/{ => gmpy2}/gmpy2.pxd | 0 src/{ => gmpy2}/gmpy2_abs.c | 0 src/{ => gmpy2}/gmpy2_abs.h | 0 src/{ => gmpy2}/gmpy2_add.c | 0 src/{ => gmpy2}/gmpy2_add.h | 0 src/{ => gmpy2}/gmpy2_binary.c | 0 src/{ => gmpy2}/gmpy2_binary.h | 0 src/{ => gmpy2}/gmpy2_cache.c | 0 src/{ => gmpy2}/gmpy2_cache.h | 0 src/{ => gmpy2}/gmpy2_cmp.c | 0 src/{ => gmpy2}/gmpy2_cmp.h | 0 src/{ => gmpy2}/gmpy2_const.c | 0 src/{ => gmpy2}/gmpy2_const.h | 0 src/{ => gmpy2}/gmpy2_context.c | 0 src/{ => gmpy2}/gmpy2_context.h | 0 src/{ => gmpy2}/gmpy2_convert.c | 0 src/{ => gmpy2}/gmpy2_convert.h | 0 src/{ => gmpy2}/gmpy2_convert_gmp.c | 0 src/{ => gmpy2}/gmpy2_convert_gmp.h | 0 src/{ => gmpy2}/gmpy2_convert_mpc.c | 0 src/{ => gmpy2}/gmpy2_convert_mpc.h | 0 src/{ => gmpy2}/gmpy2_convert_mpfr.c | 0 src/{ => gmpy2}/gmpy2_convert_mpfr.h | 0 src/{ => gmpy2}/gmpy2_convert_utils.c | 0 src/{ => gmpy2}/gmpy2_convert_utils.h | 0 src/{ => gmpy2}/gmpy2_divmod.c | 0 src/{ => gmpy2}/gmpy2_divmod.h | 0 src/{ => gmpy2}/gmpy2_floordiv.c | 0 src/{ => gmpy2}/gmpy2_floordiv.h | 0 src/{ => gmpy2}/gmpy2_format.c | 0 src/{ => gmpy2}/gmpy2_format.h | 0 src/{ => gmpy2}/gmpy2_fused.c | 0 src/{ => gmpy2}/gmpy2_fused.h | 0 src/{ => gmpy2}/gmpy2_hash.c | 0 src/{ => gmpy2}/gmpy2_hash.h | 0 src/{ => gmpy2}/gmpy2_macros.h | 0 src/{ => gmpy2}/gmpy2_math.c | 0 src/{ => gmpy2}/gmpy2_math.h | 0 src/{ => gmpy2}/gmpy2_minus.c | 0 src/{ => gmpy2}/gmpy2_minus.h | 0 src/{ => gmpy2}/gmpy2_misc.c | 0 src/{ => gmpy2}/gmpy2_misc.h | 0 src/{ => gmpy2}/gmpy2_mod.c | 0 src/{ => gmpy2}/gmpy2_mod.h | 0 src/{ => gmpy2}/gmpy2_mpc.c | 0 src/{ => gmpy2}/gmpy2_mpc.h | 0 src/{ => gmpy2}/gmpy2_mpc_misc.c | 0 src/{ => gmpy2}/gmpy2_mpc_misc.h | 0 src/{ => gmpy2}/gmpy2_mpfr.c | 0 src/{ => gmpy2}/gmpy2_mpfr.h | 0 src/{ => gmpy2}/gmpy2_mpfr_misc.c | 0 src/{ => gmpy2}/gmpy2_mpfr_misc.h | 0 src/{ => gmpy2}/gmpy2_mpmath.c | 0 src/{ => gmpy2}/gmpy2_mpq.c | 0 src/{ => gmpy2}/gmpy2_mpq.h | 0 src/{ => gmpy2}/gmpy2_mpq_misc.c | 0 src/{ => gmpy2}/gmpy2_mpq_misc.h | 0 src/{ => gmpy2}/gmpy2_mpz.c | 0 src/{ => gmpy2}/gmpy2_mpz.h | 0 src/{ => gmpy2}/gmpy2_mpz_bitops.c | 0 src/{ => gmpy2}/gmpy2_mpz_bitops.h | 0 src/{ => gmpy2}/gmpy2_mpz_divmod.c | 0 src/{ => gmpy2}/gmpy2_mpz_divmod.h | 0 src/{ => gmpy2}/gmpy2_mpz_divmod2exp.c | 0 src/{ => gmpy2}/gmpy2_mpz_divmod2exp.h | 0 src/{ => gmpy2}/gmpy2_mpz_misc.c | 0 src/{ => gmpy2}/gmpy2_mpz_misc.h | 0 src/{ => gmpy2}/gmpy2_mpz_pack.c | 0 src/{ => gmpy2}/gmpy2_mpz_pack.h | 0 src/{ => gmpy2}/gmpy2_mul.c | 0 src/{ => gmpy2}/gmpy2_mul.h | 0 src/{ => gmpy2}/gmpy2_muldiv_2exp.c | 0 src/{ => gmpy2}/gmpy2_muldiv_2exp.h | 0 src/{ => gmpy2}/gmpy2_plus.c | 0 src/{ => gmpy2}/gmpy2_plus.h | 0 src/{ => gmpy2}/gmpy2_pow.c | 0 src/{ => gmpy2}/gmpy2_pow.h | 0 src/{ => gmpy2}/gmpy2_predicate.c | 0 src/{ => gmpy2}/gmpy2_predicate.h | 0 src/{ => gmpy2}/gmpy2_random.c | 0 src/{ => gmpy2}/gmpy2_random.h | 0 src/{ => gmpy2}/gmpy2_richcompare.c | 0 src/{ => gmpy2}/gmpy2_richcompare.h | 0 src/{ => gmpy2}/gmpy2_sign.c | 0 src/{ => gmpy2}/gmpy2_sign.h | 0 src/{ => gmpy2}/gmpy2_square.c | 0 src/{ => gmpy2}/gmpy2_square.h | 0 src/{ => gmpy2}/gmpy2_sub.c | 0 src/{ => gmpy2}/gmpy2_sub.h | 0 src/{ => gmpy2}/gmpy2_truediv.c | 0 src/{ => gmpy2}/gmpy2_truediv.h | 0 src/{ => gmpy2}/gmpy2_types.h | 0 src/{ => gmpy2}/gmpy2_vector.c | 0 src/{ => gmpy2}/gmpy2_vector.h | 0 src/{ => gmpy2}/gmpy2_xmpz.c | 0 src/{ => gmpy2}/gmpy2_xmpz.h | 0 src/{ => gmpy2}/gmpy2_xmpz_inplace.c | 0 src/{ => gmpy2}/gmpy2_xmpz_inplace.h | 0 src/{ => gmpy2}/gmpy2_xmpz_limbs.c | 0 src/{ => gmpy2}/gmpy2_xmpz_limbs.h | 0 src/{ => gmpy2}/gmpy2_xmpz_misc.c | 0 src/{ => gmpy2}/gmpy2_xmpz_misc.h | 0 src/{ => gmpy2}/gmpy_mpz_lucas.c | 0 src/{ => gmpy2}/gmpy_mpz_lucas.h | 0 src/{ => gmpy2}/gmpy_mpz_prp.c | 0 src/{ => gmpy2}/gmpy_mpz_prp.h | 0 src/{ => gmpy2}/mpz_pylong.c | 0 src/{ => gmpy2}/posix64/jacobi_sum.h | 0 src/{ => gmpy2}/posix64/mpz_aprcl.c | 0 src/{ => gmpy2}/posix64/mpz_aprcl.h | 0 src/{ => gmpy2}/pythoncapi_compat.h | 0 test_cython/setup_cython.py | 9 +++++---- 123 files changed, 20 insertions(+), 29 deletions(-) delete mode 100644 gmpy2/__init__.pxd delete mode 100644 gmpy2/__init__.py delete mode 120000 gmpy2/gmpy2.h delete mode 120000 gmpy2/gmpy2.pxd rename src/{ => gmpy2}/gmpy2.c (100%) rename src/{ => gmpy2}/gmpy2.h (100%) rename src/{ => gmpy2}/gmpy2.pxd (100%) rename src/{ => gmpy2}/gmpy2_abs.c (100%) rename src/{ => gmpy2}/gmpy2_abs.h (100%) rename src/{ => gmpy2}/gmpy2_add.c (100%) rename src/{ => gmpy2}/gmpy2_add.h (100%) rename src/{ => gmpy2}/gmpy2_binary.c (100%) rename src/{ => gmpy2}/gmpy2_binary.h (100%) rename src/{ => gmpy2}/gmpy2_cache.c (100%) rename src/{ => gmpy2}/gmpy2_cache.h (100%) rename src/{ => gmpy2}/gmpy2_cmp.c (100%) rename src/{ => gmpy2}/gmpy2_cmp.h (100%) rename src/{ => gmpy2}/gmpy2_const.c (100%) rename src/{ => gmpy2}/gmpy2_const.h (100%) rename src/{ => gmpy2}/gmpy2_context.c (100%) rename src/{ => gmpy2}/gmpy2_context.h (100%) rename src/{ => gmpy2}/gmpy2_convert.c (100%) rename src/{ => gmpy2}/gmpy2_convert.h (100%) rename src/{ => gmpy2}/gmpy2_convert_gmp.c (100%) rename src/{ => gmpy2}/gmpy2_convert_gmp.h (100%) rename src/{ => gmpy2}/gmpy2_convert_mpc.c (100%) rename src/{ => gmpy2}/gmpy2_convert_mpc.h (100%) rename src/{ => gmpy2}/gmpy2_convert_mpfr.c (100%) rename src/{ => gmpy2}/gmpy2_convert_mpfr.h (100%) rename src/{ => gmpy2}/gmpy2_convert_utils.c (100%) rename src/{ => gmpy2}/gmpy2_convert_utils.h (100%) rename src/{ => gmpy2}/gmpy2_divmod.c (100%) rename src/{ => gmpy2}/gmpy2_divmod.h (100%) rename src/{ => gmpy2}/gmpy2_floordiv.c (100%) rename src/{ => gmpy2}/gmpy2_floordiv.h (100%) rename src/{ => gmpy2}/gmpy2_format.c (100%) rename src/{ => gmpy2}/gmpy2_format.h (100%) rename src/{ => gmpy2}/gmpy2_fused.c (100%) rename src/{ => gmpy2}/gmpy2_fused.h (100%) rename src/{ => gmpy2}/gmpy2_hash.c (100%) rename src/{ => gmpy2}/gmpy2_hash.h (100%) rename src/{ => gmpy2}/gmpy2_macros.h (100%) rename src/{ => gmpy2}/gmpy2_math.c (100%) rename src/{ => gmpy2}/gmpy2_math.h (100%) rename src/{ => gmpy2}/gmpy2_minus.c (100%) rename src/{ => gmpy2}/gmpy2_minus.h (100%) rename src/{ => gmpy2}/gmpy2_misc.c (100%) rename src/{ => gmpy2}/gmpy2_misc.h (100%) rename src/{ => gmpy2}/gmpy2_mod.c (100%) rename src/{ => gmpy2}/gmpy2_mod.h (100%) rename src/{ => gmpy2}/gmpy2_mpc.c (100%) rename src/{ => gmpy2}/gmpy2_mpc.h (100%) rename src/{ => gmpy2}/gmpy2_mpc_misc.c (100%) rename src/{ => gmpy2}/gmpy2_mpc_misc.h (100%) rename src/{ => gmpy2}/gmpy2_mpfr.c (100%) rename src/{ => gmpy2}/gmpy2_mpfr.h (100%) rename src/{ => gmpy2}/gmpy2_mpfr_misc.c (100%) rename src/{ => gmpy2}/gmpy2_mpfr_misc.h (100%) rename src/{ => gmpy2}/gmpy2_mpmath.c (100%) rename src/{ => gmpy2}/gmpy2_mpq.c (100%) rename src/{ => gmpy2}/gmpy2_mpq.h (100%) rename src/{ => gmpy2}/gmpy2_mpq_misc.c (100%) rename src/{ => gmpy2}/gmpy2_mpq_misc.h (100%) rename src/{ => gmpy2}/gmpy2_mpz.c (100%) rename src/{ => gmpy2}/gmpy2_mpz.h (100%) rename src/{ => gmpy2}/gmpy2_mpz_bitops.c (100%) rename src/{ => gmpy2}/gmpy2_mpz_bitops.h (100%) rename src/{ => gmpy2}/gmpy2_mpz_divmod.c (100%) rename src/{ => gmpy2}/gmpy2_mpz_divmod.h (100%) rename src/{ => gmpy2}/gmpy2_mpz_divmod2exp.c (100%) rename src/{ => gmpy2}/gmpy2_mpz_divmod2exp.h (100%) rename src/{ => gmpy2}/gmpy2_mpz_misc.c (100%) rename src/{ => gmpy2}/gmpy2_mpz_misc.h (100%) rename src/{ => gmpy2}/gmpy2_mpz_pack.c (100%) rename src/{ => gmpy2}/gmpy2_mpz_pack.h (100%) rename src/{ => gmpy2}/gmpy2_mul.c (100%) rename src/{ => gmpy2}/gmpy2_mul.h (100%) rename src/{ => gmpy2}/gmpy2_muldiv_2exp.c (100%) rename src/{ => gmpy2}/gmpy2_muldiv_2exp.h (100%) rename src/{ => gmpy2}/gmpy2_plus.c (100%) rename src/{ => gmpy2}/gmpy2_plus.h (100%) rename src/{ => gmpy2}/gmpy2_pow.c (100%) rename src/{ => gmpy2}/gmpy2_pow.h (100%) rename src/{ => gmpy2}/gmpy2_predicate.c (100%) rename src/{ => gmpy2}/gmpy2_predicate.h (100%) rename src/{ => gmpy2}/gmpy2_random.c (100%) rename src/{ => gmpy2}/gmpy2_random.h (100%) rename src/{ => gmpy2}/gmpy2_richcompare.c (100%) rename src/{ => gmpy2}/gmpy2_richcompare.h (100%) rename src/{ => gmpy2}/gmpy2_sign.c (100%) rename src/{ => gmpy2}/gmpy2_sign.h (100%) rename src/{ => gmpy2}/gmpy2_square.c (100%) rename src/{ => gmpy2}/gmpy2_square.h (100%) rename src/{ => gmpy2}/gmpy2_sub.c (100%) rename src/{ => gmpy2}/gmpy2_sub.h (100%) rename src/{ => gmpy2}/gmpy2_truediv.c (100%) rename src/{ => gmpy2}/gmpy2_truediv.h (100%) rename src/{ => gmpy2}/gmpy2_types.h (100%) rename src/{ => gmpy2}/gmpy2_vector.c (100%) rename src/{ => gmpy2}/gmpy2_vector.h (100%) rename src/{ => gmpy2}/gmpy2_xmpz.c (100%) rename src/{ => gmpy2}/gmpy2_xmpz.h (100%) rename src/{ => gmpy2}/gmpy2_xmpz_inplace.c (100%) rename src/{ => gmpy2}/gmpy2_xmpz_inplace.h (100%) rename src/{ => gmpy2}/gmpy2_xmpz_limbs.c (100%) rename src/{ => gmpy2}/gmpy2_xmpz_limbs.h (100%) rename src/{ => gmpy2}/gmpy2_xmpz_misc.c (100%) rename src/{ => gmpy2}/gmpy2_xmpz_misc.h (100%) rename src/{ => gmpy2}/gmpy_mpz_lucas.c (100%) rename src/{ => gmpy2}/gmpy_mpz_lucas.h (100%) rename src/{ => gmpy2}/gmpy_mpz_prp.c (100%) rename src/{ => gmpy2}/gmpy_mpz_prp.h (100%) rename src/{ => gmpy2}/mpz_pylong.c (100%) rename src/{ => gmpy2}/posix64/jacobi_sum.h (100%) rename src/{ => gmpy2}/posix64/mpz_aprcl.c (100%) rename src/{ => gmpy2}/posix64/mpz_aprcl.h (100%) rename src/{ => gmpy2}/pythoncapi_compat.h (100%) diff --git a/.github/workflows/pip_install_gmpy2.yml b/.github/workflows/pip_install_gmpy2.yml index 3c090b6c..e34bbc4c 100644 --- a/.github/workflows/pip_install_gmpy2.yml +++ b/.github/workflows/pip_install_gmpy2.yml @@ -19,7 +19,7 @@ jobs: - run: pip install --upgrade pip - run: pip --verbose install --editable .[tests] - run: pytest test/ - - run: PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py + - run: PYTHONPATH=`pwd`/src/gmpy2 python test_cython/runtests.py if: ${{ matrix.python-version != '3.13' }} linux: @@ -45,7 +45,7 @@ jobs: - name: Tests run: | pytest test/ - PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py + PYTHONPATH=`pwd`/src/gmpy2 python test_cython/runtests.py - name: Building docs if: matrix.python-version == 3.11 run: | @@ -60,7 +60,7 @@ jobs: python setup.py clean CFLAGS="-coverage" python setup.py develop pytest test/ - PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py + PYTHONPATH=`pwd`/src/gmpy2 python test_cython/runtests.py lcov --capture --directory . --no-external --output-file build/coverage.info genhtml build/coverage.info --output-directory build/coverage - name: Upload coverage to Codecov @@ -104,4 +104,4 @@ jobs: - run: pip install --upgrade pip - run: pip --verbose install -e .[tests] - run: pytest test/ - - run: PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py + - run: PYTHONPATH=`pwd`/src/gmpy2 python test_cython/runtests.py diff --git a/gmpy2/__init__.pxd b/gmpy2/__init__.pxd deleted file mode 100644 index 3fcc1186..00000000 --- a/gmpy2/__init__.pxd +++ /dev/null @@ -1 +0,0 @@ -from gmpy2.gmpy2 cimport * diff --git a/gmpy2/__init__.py b/gmpy2/__init__.py deleted file mode 100644 index e07a3b7c..00000000 --- a/gmpy2/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from .gmpy2 import * -from .gmpy2 import __version__ -# Internal variables/functions are not imported by * above. -# These are used by some python level functions and are needed -# at the top level. -# Use try...except to for static builds were _C_API is not available. -try: - from .gmpy2 import _C_API, _mpmath_normalize, _mpmath_create -except ImportError: - from .gmpy2 import _mpmath_normalize, _mpmath_create diff --git a/gmpy2/gmpy2.h b/gmpy2/gmpy2.h deleted file mode 120000 index 99fa021f..00000000 --- a/gmpy2/gmpy2.h +++ /dev/null @@ -1 +0,0 @@ -../src/gmpy2.h \ No newline at end of file diff --git a/gmpy2/gmpy2.pxd b/gmpy2/gmpy2.pxd deleted file mode 120000 index 34f928bc..00000000 --- a/gmpy2/gmpy2.pxd +++ /dev/null @@ -1 +0,0 @@ -../src/gmpy2.pxd \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2e74fd07..8de7a2f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,13 +45,15 @@ Homepage = 'https://github.com/aleaxit/gmpy' [tool.setuptools] zip-safe = false -include-package-data = true -[tool.setuptools.packages] -find = {namespaces = false} +[tool.setuptools.packages.find] +where = ['src'] [tool.setuptools.package-data] -gmpy2 = ['*.pxd', '*.h', '*.dll', '*.lib'] +gmpy2 = ['*.pxd', 'gmpy2.h', 'gmp.h', 'mpfr.h', 'mpc.h'] + +[tool.setuptools.exclude-package-data] +gmpy2 = ['gmpy2.c'] [tool.pytest.ini_options] addopts = "--durations=10" diff --git a/scripts/cibw_before_all.sh b/scripts/cibw_before_all.sh index 90106caa..d67610be 100644 --- a/scripts/cibw_before_all.sh +++ b/scripts/cibw_before_all.sh @@ -54,7 +54,7 @@ make install cd ../ # -- copy headers -- -cp $PREFIX/include/{gmp,mpfr,mpc}.h gmpy2/ +cp $PREFIX/include/{gmp,mpfr,mpc}.h src/gmpy2/ # -- generate *.lib files from *.dll on M$ Windows -- if [ "$OSTYPE" = "msys" ] diff --git a/scripts/cibw_repair_wheel_command.sh b/scripts/cibw_repair_wheel_command.sh index da659d2a..f123bbca 100644 --- a/scripts/cibw_repair_wheel_command.sh +++ b/scripts/cibw_repair_wheel_command.sh @@ -6,7 +6,8 @@ LD_LIBRARY_PATH="$(pwd)/.local/lib:$LD_LIBRARY_PATH" if [[ "$OSTYPE" == "darwin"* ]] then - delocate-wheel --lib-sdir ../gmpy2.libs -w ${DEST_DIR} -v ${WHEEL} + pip install -U git+https://github.com/skirpichev/delocate.git@fix-lib-sdir + delocate-wheel --lib-sdir .libs -w ${DEST_DIR} -v ${WHEEL} else auditwheel repair -w ${DEST_DIR} ${WHEEL} fi diff --git a/setup.py b/setup.py index fac0c365..2d232c54 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ ON_WINDOWS = platform.system() == 'Windows' _comp_args = ["DSHARED=1"] -sources = ['src/gmpy2.c'] +sources = ['src/gmpy2/gmpy2.c'] if os.getenv('CIBUILDWHEEL'): include_dirs = [os.path.join(os.path.dirname(__file__), '.local', 'include')] library_dirs = [os.path.join(os.path.dirname(__file__), '.local', @@ -71,7 +71,7 @@ def build_extensions(self): build_ext.build_extensions(self) extensions = [ - Extension('gmpy2.gmpy2', + Extension('gmpy2', sources=sources, include_dirs=include_dirs, libraries=['mpc','mpfr','gmp'], diff --git a/src/gmpy2.c b/src/gmpy2/gmpy2.c similarity index 100% rename from src/gmpy2.c rename to src/gmpy2/gmpy2.c diff --git a/src/gmpy2.h b/src/gmpy2/gmpy2.h similarity index 100% rename from src/gmpy2.h rename to src/gmpy2/gmpy2.h diff --git a/src/gmpy2.pxd b/src/gmpy2/gmpy2.pxd similarity index 100% rename from src/gmpy2.pxd rename to src/gmpy2/gmpy2.pxd diff --git a/src/gmpy2_abs.c b/src/gmpy2/gmpy2_abs.c similarity index 100% rename from src/gmpy2_abs.c rename to src/gmpy2/gmpy2_abs.c diff --git a/src/gmpy2_abs.h b/src/gmpy2/gmpy2_abs.h similarity index 100% rename from src/gmpy2_abs.h rename to src/gmpy2/gmpy2_abs.h diff --git a/src/gmpy2_add.c b/src/gmpy2/gmpy2_add.c similarity index 100% rename from src/gmpy2_add.c rename to src/gmpy2/gmpy2_add.c diff --git a/src/gmpy2_add.h b/src/gmpy2/gmpy2_add.h similarity index 100% rename from src/gmpy2_add.h rename to src/gmpy2/gmpy2_add.h diff --git a/src/gmpy2_binary.c b/src/gmpy2/gmpy2_binary.c similarity index 100% rename from src/gmpy2_binary.c rename to src/gmpy2/gmpy2_binary.c diff --git a/src/gmpy2_binary.h b/src/gmpy2/gmpy2_binary.h similarity index 100% rename from src/gmpy2_binary.h rename to src/gmpy2/gmpy2_binary.h diff --git a/src/gmpy2_cache.c b/src/gmpy2/gmpy2_cache.c similarity index 100% rename from src/gmpy2_cache.c rename to src/gmpy2/gmpy2_cache.c diff --git a/src/gmpy2_cache.h b/src/gmpy2/gmpy2_cache.h similarity index 100% rename from src/gmpy2_cache.h rename to src/gmpy2/gmpy2_cache.h diff --git a/src/gmpy2_cmp.c b/src/gmpy2/gmpy2_cmp.c similarity index 100% rename from src/gmpy2_cmp.c rename to src/gmpy2/gmpy2_cmp.c diff --git a/src/gmpy2_cmp.h b/src/gmpy2/gmpy2_cmp.h similarity index 100% rename from src/gmpy2_cmp.h rename to src/gmpy2/gmpy2_cmp.h diff --git a/src/gmpy2_const.c b/src/gmpy2/gmpy2_const.c similarity index 100% rename from src/gmpy2_const.c rename to src/gmpy2/gmpy2_const.c diff --git a/src/gmpy2_const.h b/src/gmpy2/gmpy2_const.h similarity index 100% rename from src/gmpy2_const.h rename to src/gmpy2/gmpy2_const.h diff --git a/src/gmpy2_context.c b/src/gmpy2/gmpy2_context.c similarity index 100% rename from src/gmpy2_context.c rename to src/gmpy2/gmpy2_context.c diff --git a/src/gmpy2_context.h b/src/gmpy2/gmpy2_context.h similarity index 100% rename from src/gmpy2_context.h rename to src/gmpy2/gmpy2_context.h diff --git a/src/gmpy2_convert.c b/src/gmpy2/gmpy2_convert.c similarity index 100% rename from src/gmpy2_convert.c rename to src/gmpy2/gmpy2_convert.c diff --git a/src/gmpy2_convert.h b/src/gmpy2/gmpy2_convert.h similarity index 100% rename from src/gmpy2_convert.h rename to src/gmpy2/gmpy2_convert.h diff --git a/src/gmpy2_convert_gmp.c b/src/gmpy2/gmpy2_convert_gmp.c similarity index 100% rename from src/gmpy2_convert_gmp.c rename to src/gmpy2/gmpy2_convert_gmp.c diff --git a/src/gmpy2_convert_gmp.h b/src/gmpy2/gmpy2_convert_gmp.h similarity index 100% rename from src/gmpy2_convert_gmp.h rename to src/gmpy2/gmpy2_convert_gmp.h diff --git a/src/gmpy2_convert_mpc.c b/src/gmpy2/gmpy2_convert_mpc.c similarity index 100% rename from src/gmpy2_convert_mpc.c rename to src/gmpy2/gmpy2_convert_mpc.c diff --git a/src/gmpy2_convert_mpc.h b/src/gmpy2/gmpy2_convert_mpc.h similarity index 100% rename from src/gmpy2_convert_mpc.h rename to src/gmpy2/gmpy2_convert_mpc.h diff --git a/src/gmpy2_convert_mpfr.c b/src/gmpy2/gmpy2_convert_mpfr.c similarity index 100% rename from src/gmpy2_convert_mpfr.c rename to src/gmpy2/gmpy2_convert_mpfr.c diff --git a/src/gmpy2_convert_mpfr.h b/src/gmpy2/gmpy2_convert_mpfr.h similarity index 100% rename from src/gmpy2_convert_mpfr.h rename to src/gmpy2/gmpy2_convert_mpfr.h diff --git a/src/gmpy2_convert_utils.c b/src/gmpy2/gmpy2_convert_utils.c similarity index 100% rename from src/gmpy2_convert_utils.c rename to src/gmpy2/gmpy2_convert_utils.c diff --git a/src/gmpy2_convert_utils.h b/src/gmpy2/gmpy2_convert_utils.h similarity index 100% rename from src/gmpy2_convert_utils.h rename to src/gmpy2/gmpy2_convert_utils.h diff --git a/src/gmpy2_divmod.c b/src/gmpy2/gmpy2_divmod.c similarity index 100% rename from src/gmpy2_divmod.c rename to src/gmpy2/gmpy2_divmod.c diff --git a/src/gmpy2_divmod.h b/src/gmpy2/gmpy2_divmod.h similarity index 100% rename from src/gmpy2_divmod.h rename to src/gmpy2/gmpy2_divmod.h diff --git a/src/gmpy2_floordiv.c b/src/gmpy2/gmpy2_floordiv.c similarity index 100% rename from src/gmpy2_floordiv.c rename to src/gmpy2/gmpy2_floordiv.c diff --git a/src/gmpy2_floordiv.h b/src/gmpy2/gmpy2_floordiv.h similarity index 100% rename from src/gmpy2_floordiv.h rename to src/gmpy2/gmpy2_floordiv.h diff --git a/src/gmpy2_format.c b/src/gmpy2/gmpy2_format.c similarity index 100% rename from src/gmpy2_format.c rename to src/gmpy2/gmpy2_format.c diff --git a/src/gmpy2_format.h b/src/gmpy2/gmpy2_format.h similarity index 100% rename from src/gmpy2_format.h rename to src/gmpy2/gmpy2_format.h diff --git a/src/gmpy2_fused.c b/src/gmpy2/gmpy2_fused.c similarity index 100% rename from src/gmpy2_fused.c rename to src/gmpy2/gmpy2_fused.c diff --git a/src/gmpy2_fused.h b/src/gmpy2/gmpy2_fused.h similarity index 100% rename from src/gmpy2_fused.h rename to src/gmpy2/gmpy2_fused.h diff --git a/src/gmpy2_hash.c b/src/gmpy2/gmpy2_hash.c similarity index 100% rename from src/gmpy2_hash.c rename to src/gmpy2/gmpy2_hash.c diff --git a/src/gmpy2_hash.h b/src/gmpy2/gmpy2_hash.h similarity index 100% rename from src/gmpy2_hash.h rename to src/gmpy2/gmpy2_hash.h diff --git a/src/gmpy2_macros.h b/src/gmpy2/gmpy2_macros.h similarity index 100% rename from src/gmpy2_macros.h rename to src/gmpy2/gmpy2_macros.h diff --git a/src/gmpy2_math.c b/src/gmpy2/gmpy2_math.c similarity index 100% rename from src/gmpy2_math.c rename to src/gmpy2/gmpy2_math.c diff --git a/src/gmpy2_math.h b/src/gmpy2/gmpy2_math.h similarity index 100% rename from src/gmpy2_math.h rename to src/gmpy2/gmpy2_math.h diff --git a/src/gmpy2_minus.c b/src/gmpy2/gmpy2_minus.c similarity index 100% rename from src/gmpy2_minus.c rename to src/gmpy2/gmpy2_minus.c diff --git a/src/gmpy2_minus.h b/src/gmpy2/gmpy2_minus.h similarity index 100% rename from src/gmpy2_minus.h rename to src/gmpy2/gmpy2_minus.h diff --git a/src/gmpy2_misc.c b/src/gmpy2/gmpy2_misc.c similarity index 100% rename from src/gmpy2_misc.c rename to src/gmpy2/gmpy2_misc.c diff --git a/src/gmpy2_misc.h b/src/gmpy2/gmpy2_misc.h similarity index 100% rename from src/gmpy2_misc.h rename to src/gmpy2/gmpy2_misc.h diff --git a/src/gmpy2_mod.c b/src/gmpy2/gmpy2_mod.c similarity index 100% rename from src/gmpy2_mod.c rename to src/gmpy2/gmpy2_mod.c diff --git a/src/gmpy2_mod.h b/src/gmpy2/gmpy2_mod.h similarity index 100% rename from src/gmpy2_mod.h rename to src/gmpy2/gmpy2_mod.h diff --git a/src/gmpy2_mpc.c b/src/gmpy2/gmpy2_mpc.c similarity index 100% rename from src/gmpy2_mpc.c rename to src/gmpy2/gmpy2_mpc.c diff --git a/src/gmpy2_mpc.h b/src/gmpy2/gmpy2_mpc.h similarity index 100% rename from src/gmpy2_mpc.h rename to src/gmpy2/gmpy2_mpc.h diff --git a/src/gmpy2_mpc_misc.c b/src/gmpy2/gmpy2_mpc_misc.c similarity index 100% rename from src/gmpy2_mpc_misc.c rename to src/gmpy2/gmpy2_mpc_misc.c diff --git a/src/gmpy2_mpc_misc.h b/src/gmpy2/gmpy2_mpc_misc.h similarity index 100% rename from src/gmpy2_mpc_misc.h rename to src/gmpy2/gmpy2_mpc_misc.h diff --git a/src/gmpy2_mpfr.c b/src/gmpy2/gmpy2_mpfr.c similarity index 100% rename from src/gmpy2_mpfr.c rename to src/gmpy2/gmpy2_mpfr.c diff --git a/src/gmpy2_mpfr.h b/src/gmpy2/gmpy2_mpfr.h similarity index 100% rename from src/gmpy2_mpfr.h rename to src/gmpy2/gmpy2_mpfr.h diff --git a/src/gmpy2_mpfr_misc.c b/src/gmpy2/gmpy2_mpfr_misc.c similarity index 100% rename from src/gmpy2_mpfr_misc.c rename to src/gmpy2/gmpy2_mpfr_misc.c diff --git a/src/gmpy2_mpfr_misc.h b/src/gmpy2/gmpy2_mpfr_misc.h similarity index 100% rename from src/gmpy2_mpfr_misc.h rename to src/gmpy2/gmpy2_mpfr_misc.h diff --git a/src/gmpy2_mpmath.c b/src/gmpy2/gmpy2_mpmath.c similarity index 100% rename from src/gmpy2_mpmath.c rename to src/gmpy2/gmpy2_mpmath.c diff --git a/src/gmpy2_mpq.c b/src/gmpy2/gmpy2_mpq.c similarity index 100% rename from src/gmpy2_mpq.c rename to src/gmpy2/gmpy2_mpq.c diff --git a/src/gmpy2_mpq.h b/src/gmpy2/gmpy2_mpq.h similarity index 100% rename from src/gmpy2_mpq.h rename to src/gmpy2/gmpy2_mpq.h diff --git a/src/gmpy2_mpq_misc.c b/src/gmpy2/gmpy2_mpq_misc.c similarity index 100% rename from src/gmpy2_mpq_misc.c rename to src/gmpy2/gmpy2_mpq_misc.c diff --git a/src/gmpy2_mpq_misc.h b/src/gmpy2/gmpy2_mpq_misc.h similarity index 100% rename from src/gmpy2_mpq_misc.h rename to src/gmpy2/gmpy2_mpq_misc.h diff --git a/src/gmpy2_mpz.c b/src/gmpy2/gmpy2_mpz.c similarity index 100% rename from src/gmpy2_mpz.c rename to src/gmpy2/gmpy2_mpz.c diff --git a/src/gmpy2_mpz.h b/src/gmpy2/gmpy2_mpz.h similarity index 100% rename from src/gmpy2_mpz.h rename to src/gmpy2/gmpy2_mpz.h diff --git a/src/gmpy2_mpz_bitops.c b/src/gmpy2/gmpy2_mpz_bitops.c similarity index 100% rename from src/gmpy2_mpz_bitops.c rename to src/gmpy2/gmpy2_mpz_bitops.c diff --git a/src/gmpy2_mpz_bitops.h b/src/gmpy2/gmpy2_mpz_bitops.h similarity index 100% rename from src/gmpy2_mpz_bitops.h rename to src/gmpy2/gmpy2_mpz_bitops.h diff --git a/src/gmpy2_mpz_divmod.c b/src/gmpy2/gmpy2_mpz_divmod.c similarity index 100% rename from src/gmpy2_mpz_divmod.c rename to src/gmpy2/gmpy2_mpz_divmod.c diff --git a/src/gmpy2_mpz_divmod.h b/src/gmpy2/gmpy2_mpz_divmod.h similarity index 100% rename from src/gmpy2_mpz_divmod.h rename to src/gmpy2/gmpy2_mpz_divmod.h diff --git a/src/gmpy2_mpz_divmod2exp.c b/src/gmpy2/gmpy2_mpz_divmod2exp.c similarity index 100% rename from src/gmpy2_mpz_divmod2exp.c rename to src/gmpy2/gmpy2_mpz_divmod2exp.c diff --git a/src/gmpy2_mpz_divmod2exp.h b/src/gmpy2/gmpy2_mpz_divmod2exp.h similarity index 100% rename from src/gmpy2_mpz_divmod2exp.h rename to src/gmpy2/gmpy2_mpz_divmod2exp.h diff --git a/src/gmpy2_mpz_misc.c b/src/gmpy2/gmpy2_mpz_misc.c similarity index 100% rename from src/gmpy2_mpz_misc.c rename to src/gmpy2/gmpy2_mpz_misc.c diff --git a/src/gmpy2_mpz_misc.h b/src/gmpy2/gmpy2_mpz_misc.h similarity index 100% rename from src/gmpy2_mpz_misc.h rename to src/gmpy2/gmpy2_mpz_misc.h diff --git a/src/gmpy2_mpz_pack.c b/src/gmpy2/gmpy2_mpz_pack.c similarity index 100% rename from src/gmpy2_mpz_pack.c rename to src/gmpy2/gmpy2_mpz_pack.c diff --git a/src/gmpy2_mpz_pack.h b/src/gmpy2/gmpy2_mpz_pack.h similarity index 100% rename from src/gmpy2_mpz_pack.h rename to src/gmpy2/gmpy2_mpz_pack.h diff --git a/src/gmpy2_mul.c b/src/gmpy2/gmpy2_mul.c similarity index 100% rename from src/gmpy2_mul.c rename to src/gmpy2/gmpy2_mul.c diff --git a/src/gmpy2_mul.h b/src/gmpy2/gmpy2_mul.h similarity index 100% rename from src/gmpy2_mul.h rename to src/gmpy2/gmpy2_mul.h diff --git a/src/gmpy2_muldiv_2exp.c b/src/gmpy2/gmpy2_muldiv_2exp.c similarity index 100% rename from src/gmpy2_muldiv_2exp.c rename to src/gmpy2/gmpy2_muldiv_2exp.c diff --git a/src/gmpy2_muldiv_2exp.h b/src/gmpy2/gmpy2_muldiv_2exp.h similarity index 100% rename from src/gmpy2_muldiv_2exp.h rename to src/gmpy2/gmpy2_muldiv_2exp.h diff --git a/src/gmpy2_plus.c b/src/gmpy2/gmpy2_plus.c similarity index 100% rename from src/gmpy2_plus.c rename to src/gmpy2/gmpy2_plus.c diff --git a/src/gmpy2_plus.h b/src/gmpy2/gmpy2_plus.h similarity index 100% rename from src/gmpy2_plus.h rename to src/gmpy2/gmpy2_plus.h diff --git a/src/gmpy2_pow.c b/src/gmpy2/gmpy2_pow.c similarity index 100% rename from src/gmpy2_pow.c rename to src/gmpy2/gmpy2_pow.c diff --git a/src/gmpy2_pow.h b/src/gmpy2/gmpy2_pow.h similarity index 100% rename from src/gmpy2_pow.h rename to src/gmpy2/gmpy2_pow.h diff --git a/src/gmpy2_predicate.c b/src/gmpy2/gmpy2_predicate.c similarity index 100% rename from src/gmpy2_predicate.c rename to src/gmpy2/gmpy2_predicate.c diff --git a/src/gmpy2_predicate.h b/src/gmpy2/gmpy2_predicate.h similarity index 100% rename from src/gmpy2_predicate.h rename to src/gmpy2/gmpy2_predicate.h diff --git a/src/gmpy2_random.c b/src/gmpy2/gmpy2_random.c similarity index 100% rename from src/gmpy2_random.c rename to src/gmpy2/gmpy2_random.c diff --git a/src/gmpy2_random.h b/src/gmpy2/gmpy2_random.h similarity index 100% rename from src/gmpy2_random.h rename to src/gmpy2/gmpy2_random.h diff --git a/src/gmpy2_richcompare.c b/src/gmpy2/gmpy2_richcompare.c similarity index 100% rename from src/gmpy2_richcompare.c rename to src/gmpy2/gmpy2_richcompare.c diff --git a/src/gmpy2_richcompare.h b/src/gmpy2/gmpy2_richcompare.h similarity index 100% rename from src/gmpy2_richcompare.h rename to src/gmpy2/gmpy2_richcompare.h diff --git a/src/gmpy2_sign.c b/src/gmpy2/gmpy2_sign.c similarity index 100% rename from src/gmpy2_sign.c rename to src/gmpy2/gmpy2_sign.c diff --git a/src/gmpy2_sign.h b/src/gmpy2/gmpy2_sign.h similarity index 100% rename from src/gmpy2_sign.h rename to src/gmpy2/gmpy2_sign.h diff --git a/src/gmpy2_square.c b/src/gmpy2/gmpy2_square.c similarity index 100% rename from src/gmpy2_square.c rename to src/gmpy2/gmpy2_square.c diff --git a/src/gmpy2_square.h b/src/gmpy2/gmpy2_square.h similarity index 100% rename from src/gmpy2_square.h rename to src/gmpy2/gmpy2_square.h diff --git a/src/gmpy2_sub.c b/src/gmpy2/gmpy2_sub.c similarity index 100% rename from src/gmpy2_sub.c rename to src/gmpy2/gmpy2_sub.c diff --git a/src/gmpy2_sub.h b/src/gmpy2/gmpy2_sub.h similarity index 100% rename from src/gmpy2_sub.h rename to src/gmpy2/gmpy2_sub.h diff --git a/src/gmpy2_truediv.c b/src/gmpy2/gmpy2_truediv.c similarity index 100% rename from src/gmpy2_truediv.c rename to src/gmpy2/gmpy2_truediv.c diff --git a/src/gmpy2_truediv.h b/src/gmpy2/gmpy2_truediv.h similarity index 100% rename from src/gmpy2_truediv.h rename to src/gmpy2/gmpy2_truediv.h diff --git a/src/gmpy2_types.h b/src/gmpy2/gmpy2_types.h similarity index 100% rename from src/gmpy2_types.h rename to src/gmpy2/gmpy2_types.h diff --git a/src/gmpy2_vector.c b/src/gmpy2/gmpy2_vector.c similarity index 100% rename from src/gmpy2_vector.c rename to src/gmpy2/gmpy2_vector.c diff --git a/src/gmpy2_vector.h b/src/gmpy2/gmpy2_vector.h similarity index 100% rename from src/gmpy2_vector.h rename to src/gmpy2/gmpy2_vector.h diff --git a/src/gmpy2_xmpz.c b/src/gmpy2/gmpy2_xmpz.c similarity index 100% rename from src/gmpy2_xmpz.c rename to src/gmpy2/gmpy2_xmpz.c diff --git a/src/gmpy2_xmpz.h b/src/gmpy2/gmpy2_xmpz.h similarity index 100% rename from src/gmpy2_xmpz.h rename to src/gmpy2/gmpy2_xmpz.h diff --git a/src/gmpy2_xmpz_inplace.c b/src/gmpy2/gmpy2_xmpz_inplace.c similarity index 100% rename from src/gmpy2_xmpz_inplace.c rename to src/gmpy2/gmpy2_xmpz_inplace.c diff --git a/src/gmpy2_xmpz_inplace.h b/src/gmpy2/gmpy2_xmpz_inplace.h similarity index 100% rename from src/gmpy2_xmpz_inplace.h rename to src/gmpy2/gmpy2_xmpz_inplace.h diff --git a/src/gmpy2_xmpz_limbs.c b/src/gmpy2/gmpy2_xmpz_limbs.c similarity index 100% rename from src/gmpy2_xmpz_limbs.c rename to src/gmpy2/gmpy2_xmpz_limbs.c diff --git a/src/gmpy2_xmpz_limbs.h b/src/gmpy2/gmpy2_xmpz_limbs.h similarity index 100% rename from src/gmpy2_xmpz_limbs.h rename to src/gmpy2/gmpy2_xmpz_limbs.h diff --git a/src/gmpy2_xmpz_misc.c b/src/gmpy2/gmpy2_xmpz_misc.c similarity index 100% rename from src/gmpy2_xmpz_misc.c rename to src/gmpy2/gmpy2_xmpz_misc.c diff --git a/src/gmpy2_xmpz_misc.h b/src/gmpy2/gmpy2_xmpz_misc.h similarity index 100% rename from src/gmpy2_xmpz_misc.h rename to src/gmpy2/gmpy2_xmpz_misc.h diff --git a/src/gmpy_mpz_lucas.c b/src/gmpy2/gmpy_mpz_lucas.c similarity index 100% rename from src/gmpy_mpz_lucas.c rename to src/gmpy2/gmpy_mpz_lucas.c diff --git a/src/gmpy_mpz_lucas.h b/src/gmpy2/gmpy_mpz_lucas.h similarity index 100% rename from src/gmpy_mpz_lucas.h rename to src/gmpy2/gmpy_mpz_lucas.h diff --git a/src/gmpy_mpz_prp.c b/src/gmpy2/gmpy_mpz_prp.c similarity index 100% rename from src/gmpy_mpz_prp.c rename to src/gmpy2/gmpy_mpz_prp.c diff --git a/src/gmpy_mpz_prp.h b/src/gmpy2/gmpy_mpz_prp.h similarity index 100% rename from src/gmpy_mpz_prp.h rename to src/gmpy2/gmpy_mpz_prp.h diff --git a/src/mpz_pylong.c b/src/gmpy2/mpz_pylong.c similarity index 100% rename from src/mpz_pylong.c rename to src/gmpy2/mpz_pylong.c diff --git a/src/posix64/jacobi_sum.h b/src/gmpy2/posix64/jacobi_sum.h similarity index 100% rename from src/posix64/jacobi_sum.h rename to src/gmpy2/posix64/jacobi_sum.h diff --git a/src/posix64/mpz_aprcl.c b/src/gmpy2/posix64/mpz_aprcl.c similarity index 100% rename from src/posix64/mpz_aprcl.c rename to src/gmpy2/posix64/mpz_aprcl.c diff --git a/src/posix64/mpz_aprcl.h b/src/gmpy2/posix64/mpz_aprcl.h similarity index 100% rename from src/posix64/mpz_aprcl.h rename to src/gmpy2/posix64/mpz_aprcl.h diff --git a/src/pythoncapi_compat.h b/src/gmpy2/pythoncapi_compat.h similarity index 100% rename from src/pythoncapi_compat.h rename to src/gmpy2/pythoncapi_compat.h diff --git a/test_cython/setup_cython.py b/test_cython/setup_cython.py index 77e28853..c9ab3183 100644 --- a/test_cython/setup_cython.py +++ b/test_cython/setup_cython.py @@ -6,10 +6,11 @@ import gmpy2 gmpy2_packagedir = os.path.dirname(gmpy2.__file__) -library_dirs = sys.path + [gmpy2_packagedir] +include_dirs = sys.path + [os.path.join(gmpy2_packagedir, 'gmpy2')] +library_dirs = include_dirs libnames = ['mpc','mpfr','gmp'] -bundled_libs = os.path.join(gmpy2_packagedir, '..', 'gmpy2.libs') +bundled_libs = os.path.join(gmpy2_packagedir, 'gmpy2.libs') if os.path.isdir(bundled_libs): library_dirs += [bundled_libs] if platform.system() == 'Linux': @@ -20,12 +21,12 @@ extensions = [ Extension("test_cython", ["test_cython.pyx"], - include_dirs=sys.path + [gmpy2_packagedir], + include_dirs=include_dirs, library_dirs=library_dirs, libraries=libnames)] setup( name="cython_gmpy_test", - ext_modules=cythonize(extensions, include_path=sys.path, + ext_modules=cythonize(extensions, include_path=include_dirs, compiler_directives={'language_level' : "3"}) )