diff --git a/build/pkgs/conway_polynomials/SPKG.rst b/build/pkgs/conway_polynomials/SPKG.rst index 64a5bad04df..f5755f505d3 100644 --- a/build/pkgs/conway_polynomials/SPKG.rst +++ b/build/pkgs/conway_polynomials/SPKG.rst @@ -1,12 +1,26 @@ -conway_polynomials: Tables of Conway polynomials over finite fields -=================================================================== +conway_polynomials: Python interface to Frank Lübeck's Conway polynomial database +================================================================================= Description ----------- -Frank Lübeck's tables of Conway polynomials over finite fields. +This python module evolved from the old SageMath *conway_polynomials* +package once hosted at, -Upstream contact + http://files.sagemath.org/spkg/upstream/conway_polynomials/ + +It's still maintained by Sage developers, but having a pip-installable +interface to the data will make it easier to install SageMath via pip +or another package manager. + + +License +------- + +GPL version 3 or later + + +Upstream Contact ---------------- -http://www.math.rwth-aachen.de/~Frank.Luebeck/data/ConwayPol/ +https://github.com/sagemath/conway-polynomials diff --git a/build/pkgs/conway_polynomials/checksums.ini b/build/pkgs/conway_polynomials/checksums.ini index cedb5575263..eeb24706c7d 100644 --- a/build/pkgs/conway_polynomials/checksums.ini +++ b/build/pkgs/conway_polynomials/checksums.ini @@ -1,4 +1,5 @@ -tarball=conway_polynomials-VERSION.tar.bz2 -sha1=d4d89bda60ac54e73121f84635e774766e19a8b6 -md5=a2725ba21f44554196781424d957f68a -cksum=1387933493 +tarball=conway-polynomials-VERSION.tar.gz +sha1=cf0904c184d7f947eaae0de1b0e2e47411e9cfda +md5=ddc0e82da67120efc353a6ec29c4cca2 +cksum=2976854063 +upstream_url=https://files.pythonhosted.org/packages/source/c/conway-polynomials/conway-polynomials-VERSION.tar.gz diff --git a/build/pkgs/conway_polynomials/dependencies b/build/pkgs/conway_polynomials/dependencies index 6b134137610..78d6ec8d5a7 100644 --- a/build/pkgs/conway_polynomials/dependencies +++ b/build/pkgs/conway_polynomials/dependencies @@ -1,4 +1,4 @@ -| $(PYTHON) +| $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/conway_polynomials/distros/conda.txt b/build/pkgs/conway_polynomials/distros/conda.txt index a8228a35e86..3283bb6c3ee 100644 --- a/build/pkgs/conway_polynomials/distros/conda.txt +++ b/build/pkgs/conway_polynomials/distros/conda.txt @@ -1 +1 @@ -sagemath-db-conway-polynomials +conway-polynomials diff --git a/build/pkgs/conway_polynomials/distros/gentoo.txt b/build/pkgs/conway_polynomials/distros/gentoo.txt new file mode 100644 index 00000000000..28b8f1b864b --- /dev/null +++ b/build/pkgs/conway_polynomials/distros/gentoo.txt @@ -0,0 +1 @@ +dev-python/conway-polynomials diff --git a/build/pkgs/conway_polynomials/install-requires.txt b/build/pkgs/conway_polynomials/install-requires.txt new file mode 100644 index 00000000000..308e934cef1 --- /dev/null +++ b/build/pkgs/conway_polynomials/install-requires.txt @@ -0,0 +1 @@ +conway-polynomials >=0.8 diff --git a/build/pkgs/conway_polynomials/package-version.txt b/build/pkgs/conway_polynomials/package-version.txt index 2eb3c4fe4ee..aec258df73d 100644 --- a/build/pkgs/conway_polynomials/package-version.txt +++ b/build/pkgs/conway_polynomials/package-version.txt @@ -1 +1 @@ -0.5 +0.8 diff --git a/build/pkgs/conway_polynomials/spkg-configure.m4 b/build/pkgs/conway_polynomials/spkg-configure.m4 new file mode 100644 index 00000000000..f55f76cbe05 --- /dev/null +++ b/build/pkgs/conway_polynomials/spkg-configure.m4 @@ -0,0 +1,3 @@ +SAGE_SPKG_CONFIGURE([conway_polynomials], [ + SAGE_PYTHON_PACKAGE_CHECK([conway_polynomials]) +]) diff --git a/build/pkgs/conway_polynomials/spkg-install.in b/build/pkgs/conway_polynomials/spkg-install.in index a917196c0c4..deba1bb42bb 100644 --- a/build/pkgs/conway_polynomials/spkg-install.in +++ b/build/pkgs/conway_polynomials/spkg-install.in @@ -1 +1 @@ -exec python3 spkg-install.py +cd src && sdh_pip_install . diff --git a/build/pkgs/conway_polynomials/spkg-install.py b/build/pkgs/conway_polynomials/spkg-install.py deleted file mode 100644 index cb192719d63..00000000000 --- a/build/pkgs/conway_polynomials/spkg-install.py +++ /dev/null @@ -1,20 +0,0 @@ -import os -import pickle - -SAGE_SHARE = os.getenv('SAGE_SHARE') -install_root = os.path.join(SAGE_SHARE, 'conway_polynomials') - -def create_db(): - db = {} - from src import conway_polynomials - for p, n, v in conway_polynomials: - if not p in db: - db[p] = {} - db[p][n] = v - if not os.path.exists(install_root): - os.makedirs(install_root) - with open(os.path.join(install_root, 'conway_polynomials.p'), 'wb') as f: - pickle.dump(db, f) - -if __name__ == '__main__': - create_db() diff --git a/src/sage/databases/all.py b/src/sage/databases/all.py index 8f0daa2aac7..a6571c7a5df 100644 --- a/src/sage/databases/all.py +++ b/src/sage/databases/all.py @@ -23,7 +23,7 @@ EXAMPLES:: sage: ConwayPolynomials() - Frank Luebeck's database of Conway polynomials + Frank Lübeck's database of Conway polynomials sage: CremonaDatabase() Cremona's database of elliptic curves with conductor... diff --git a/src/sage/databases/conway.py b/src/sage/databases/conway.py index 600c5a7c1ff..b1f76292ce8 100644 --- a/src/sage/databases/conway.py +++ b/src/sage/databases/conway.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- r""" -Frank Luebeck's tables of Conway polynomials over finite fields +Frank Lübeck's tables of Conway polynomials over finite fields """ # **************************************************************************** # @@ -15,12 +15,6 @@ # https://www.gnu.org/licenses/ # **************************************************************************** from collections.abc import Mapping -import pickle - -from sage.features.databases import DatabaseConwayPolynomials - -_conwaydict = None - class DictInMapping(Mapping): def __init__(self, dict): @@ -95,14 +89,10 @@ def __init__(self): sage: c = ConwayPolynomials() sage: c - Frank Luebeck's database of Conway polynomials + Frank Lübeck's database of Conway polynomials """ - global _conwaydict - if _conwaydict is None: - _CONWAYDATA = DatabaseConwayPolynomials().absolute_filename() - with open(_CONWAYDATA, 'rb') as f: - _conwaydict = pickle.load(f) - self._store = _conwaydict + import conway_polynomials + self._store = conway_polynomials.database() def __repr__(self): """ @@ -112,9 +102,9 @@ def __repr__(self): sage: c = ConwayPolynomials() sage: c.__repr__() - "Frank Luebeck's database of Conway polynomials" + "Frank Lübeck's database of Conway polynomials" """ - return "Frank Luebeck's database of Conway polynomials" + return "Frank Lübeck's database of Conway polynomials" def __getitem__(self, key): """ @@ -152,7 +142,7 @@ def __len__(self): sage: c = ConwayPolynomials() sage: len(c) - 35352 + 35357 """ try: return self._len diff --git a/src/sage/env.py b/src/sage/env.py index 9ab6b1e1864..941bd0ec6b3 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -195,7 +195,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st SAGE_PKG_CONFIG_PATH = var("SAGE_PKG_CONFIG_PATH") # installation directories for various packages -CONWAY_POLYNOMIALS_DATA_DIR = var("CONWAY_POLYNOMIALS_DATA_DIR", join(SAGE_SHARE, "conway_polynomials")) GRAPHS_DATA_DIR = var("GRAPHS_DATA_DIR", join(SAGE_SHARE, "graphs")) ELLCURVE_DATA_DIR = var("ELLCURVE_DATA_DIR", join(SAGE_SHARE, "ellcurves")) POLYTOPE_DATA_DIR = var("POLYTOPE_DATA_DIR", join(SAGE_SHARE, "reflexive_polytopes")) diff --git a/src/sage/features/__init__.py b/src/sage/features/__init__.py index cabd63a1a24..be55d44d0c2 100644 --- a/src/sage/features/__init__.py +++ b/src/sage/features/__init__.py @@ -252,9 +252,6 @@ def __repr__(self): sage: GapPackage("grape") # indirect doctest Feature('gap_package_grape') - sage: from sage.features.databases import DatabaseConwayPolynomials - sage: DatabaseConwayPolynomials() # indirect doctest - Feature('conway_polynomials': Frank Luebeck's database of Conway polynomials) """ description = f'{self.name!r}: {self.description}' if self.description else f'{self.name!r}' return f'Feature({description})' @@ -342,11 +339,10 @@ def is_standard(self): EXAMPLES:: - sage: from sage.features.databases import DatabaseCremona, DatabaseConwayPolynomials + sage: from sage.features.databases import DatabaseCremona sage: DatabaseCremona().is_standard() False - sage: DatabaseConwayPolynomials().is_standard() - True + """ if self.name.startswith('sage.'): return True @@ -358,11 +354,10 @@ def is_optional(self): EXAMPLES:: - sage: from sage.features.databases import DatabaseCremona, DatabaseConwayPolynomials + sage: from sage.features.databases import DatabaseCremona sage: DatabaseCremona().is_optional() True - sage: DatabaseConwayPolynomials().is_optional() - False + """ return self._spkg_type() == 'optional' diff --git a/src/sage/features/databases.py b/src/sage/features/databases.py index f9b297b1e30..bca8c094b30 100644 --- a/src/sage/features/databases.py +++ b/src/sage/features/databases.py @@ -19,43 +19,10 @@ from . import StaticFile, PythonModule from sage.env import ( - CONWAY_POLYNOMIALS_DATA_DIR, CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR, POLYTOPE_DATA_DIR) -class DatabaseConwayPolynomials(StaticFile): - r""" - A :class:`~sage.features.Feature` which describes the presence of :ref:`Frank Luebeck's - database of Conway polynomials `. - - EXAMPLES:: - - sage: from sage.features.databases import DatabaseConwayPolynomials - sage: DatabaseConwayPolynomials().is_present() - FeatureTestResult('conway_polynomials', True) - """ - - def __init__(self): - r""" - TESTS:: - - sage: from sage.features.databases import DatabaseConwayPolynomials - sage: isinstance(DatabaseConwayPolynomials(), DatabaseConwayPolynomials) - True - """ - if CONWAY_POLYNOMIALS_DATA_DIR: - search_path = [CONWAY_POLYNOMIALS_DATA_DIR] - else: - search_path = [] - StaticFile.__init__(self, "conway_polynomials", - filename='conway_polynomials.p', - search_path=search_path, - spkg='conway_polynomials', - description="Frank Luebeck's database of Conway polynomials", - type='standard') - - CREMONA_DATA_DIRS = set([CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR]) @@ -197,8 +164,7 @@ def __init__(self, name='polytopes_db', dirname='Full3D'): def all_features(): - return [DatabaseConwayPolynomials(), - DatabaseCremona(), DatabaseCremona('cremona_mini'), + return [DatabaseCremona(), DatabaseCremona('cremona_mini'), DatabaseJones(), DatabaseKnotInfo(), DatabaseCubicHecke(), diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 index 41ac1c08bfa..7a5bfb61c26 100644 --- a/src/setup.cfg.m4 +++ b/src/setup.cfg.m4 @@ -14,6 +14,7 @@ install_requires = SPKG_INSTALL_REQUIRES_sage_conf SPKG_INSTALL_REQUIRES_six dnl From build/pkgs/sagelib/dependencies + SPKG_INSTALL_REQUIRES_conway_polynomials SPKG_INSTALL_REQUIRES_cypari SPKG_INSTALL_REQUIRES_cysignals SPKG_INSTALL_REQUIRES_cython