diff --git a/build/pkgs/gap/checksums.ini b/build/pkgs/gap/checksums.ini index 066e943308a..b0ea8ba8818 100644 --- a/build/pkgs/gap/checksums.ini +++ b/build/pkgs/gap/checksums.ini @@ -1,5 +1,5 @@ tarball=gap-VERSION.tar.gz -sha1=4ecdd281b8f430282fb9b12690b06e0a26abde10 -md5=85dc9e459d5b6c66fcad9f468afd3e3e -cksum=1351843158 +sha1=a6e36f3f874a2c46f51561402634497eab705cca +md5=c5cd9f272f2703d7a3649ad7193b2d90 +cksum=2760477284 upstream_url=https://github.com/gap-system/gap/releases/download/vVERSION/gap-VERSION.tar.gz diff --git a/build/pkgs/gap/package-version.txt b/build/pkgs/gap/package-version.txt index d782fca8f64..f1cd7de1de5 100644 --- a/build/pkgs/gap/package-version.txt +++ b/build/pkgs/gap/package-version.txt @@ -1 +1 @@ -4.11.1 +4.12.2 diff --git a/build/pkgs/gap/spkg-check.in b/build/pkgs/gap/spkg-check.in index d9791d33293..d2fccda6e04 100644 --- a/build/pkgs/gap/spkg-check.in +++ b/build/pkgs/gap/spkg-check.in @@ -3,6 +3,13 @@ cd src # #28728: Fix test failure in tst/testinstall/strings.tst export LC_CTYPE=en_US.UTF-8 +# #34391: in GAP 4.12 some packages need GAP package io +# to let tests run, otherwise this hangs. Thus we install io here. +cd pkg/io +./configure --with-gaproot=../.. +make +cd ../.. + make testinstall if [[ $? -ne 0 ]]; then exit 1 diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in index 30320027274..47a7a8700ac 100644 --- a/build/pkgs/gap/spkg-install.in +++ b/build/pkgs/gap/spkg-install.in @@ -8,8 +8,7 @@ export CFLAGS=$CFLAGS_NON_NATIVE export CXXFLAGS=$CXXFLAGS_NON_NATIVE GAP_BUILD_ROOT="$(pwd)" -GAP_ROOT="$SAGE_LOCAL/share/gap" -DESTDIR_GAP_ROOT="$SAGE_DESTDIR$GAP_ROOT" +GAP_ROOT="$SAGE_LOCAL/lib/gap" # Enable debug info if requested. # Note that -g3 allows you to use preprocessor macros in gdb which are widely used @@ -17,37 +16,17 @@ if [ "$SAGE_DEBUG" = yes ] ; then export CFLAGS="-O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS $CFLAGS" fi -sdh_configure $SAGE_CONFIGURE_GMP -sdh_make -j1 +# LDFLAGS hack below needed by Semigroups package +sdh_configure $SAGE_CONFIGURE_GMP LDFLAGS="-pthread" --prefix=$SAGE_LOCAL +sdh_make -# GAP's "make install" is work in progress; we use bits and pieces of it -# but we install many things manually. -sdh_make install-headers install-libgap - -# Install config.h, which is not currently handled by `make install-headers` -sdh_install gen/config.h "$SAGE_LOCAL/include/gap" - -# Now install the gap executable as "gap-bin"; it will be called normally -# through our wrapper script that sets the appropriate GAP_ROOT -SAGE_BIN="$SAGE_LOCAL/bin" -mkdir -p "$SAGE_DESTDIR$SAGE_BIN" || sdh_die "Failed to create the directory $SAGE_BIN" - -./libtool --mode=install install gap "$SAGE_DESTDIR$SAGE_BIN/gap-bin" || \ - sdh_die "Failed to install gap-bin to $SAGE_BIN" - -./libtool --mode=install install gac "$SAGE_DESTDIR$SAGE_BIN/gac" || \ - sdh_die "Failed to install gac to $SAGE_BIN" - -# Now copy additional files GAP needs to run (and a few optional bits) into -# GAP_ROOT; we don't need everything from the source tree -sdh_install bin doc gen grp lib src tst sysinfo.gap "$GAP_ROOT" - -# GAP's copy of libtool is also used by the toolchain for build GAP packages -# (i.e. by gac) -sdh_install libtool "$GAP_ROOT" +sdh_make_install +# sdh_make install-headers install-libgap +# The 'packagemanager' package expects this https://github.com/gap-packages/PackageManager/issues/105 +mkdir -p "$SAGE_LOCAL/lib/gap/bin" # Install only the minimal packages GAP needs to run -sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/pkg +sdh_install pkg/gapdoc pkg/primgrp pkg/smallgrp pkg/transgrp "$GAP_ROOT"/pkg # Install additional packages that are not strictly required, but that are # typically "expected" to be loaded: These are the default packages that are @@ -58,50 +37,25 @@ sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/p # Also include atlasrep which is a dependency of tomlib sdh_install \ pkg/atlasrep \ - pkg/autpgrp-* \ - pkg/alnuth-* \ - pkg/crisp-* \ - pkg/ctbllib-* \ - pkg/FactInt-* \ + pkg/autodoc \ + pkg/autpgrp \ + pkg/alnuth \ + pkg/crisp \ + pkg/ctbllib \ + pkg/factint \ pkg/fga \ - pkg/irredsol-* \ - pkg/laguna-* \ - pkg/PackageManager-* \ - pkg/polenta-* \ - pkg/polycyclic-* \ - pkg/resclasses-* \ - pkg/sophus-* \ - pkg/tomlib-* \ + pkg/irredsol \ + pkg/laguna \ + pkg/packagemanager \ + pkg/polenta \ + pkg/polycyclic \ + pkg/radiroot \ + pkg/resclasses \ + pkg/sophus \ + pkg/tomlib \ + pkg/utils \ "$GAP_ROOT"/pkg -# Install the GAP startup script; ensure it is executable -sdh_install -T ../gap "$SAGE_BIN/gap" -chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap" - -# Create symlinks under $GAP_ROOT for these executables, as they are expected -# (especially when building kernel packages) to exist -ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap" -ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac" - -# Fix the $GAP_ROOT/bin//src symlink to be relative (otherwise it links -# to the actual path of the sources GAP was compiled from) -for srclink in "$DESTDIR_GAP_ROOT"/bin/*/src; do - rm -f "$srclink" - ln -s "../../src" "$srclink" -done - -# Additional fixups for some files after they have been copied into their -# destination directory. gac and sysinfo.gap are generated files that contain -# in them hard-coded references to the GAP build directory, which will soon -# be going away. This breaks the build toolchain for some compiled GAP -# packages. We need to replace these paths with the final GAP_ROOT path. The -# below will work so long as neither of these paths contain '|', and if they do -# then god help you. https://github.com/sagemath/sage/issues/27218 -sed -i -e "s|$GAP_BUILD_ROOT|$GAP_ROOT|g" \ - "$SAGE_DESTDIR$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/sysinfo.gap" \ - "$DESTDIR_GAP_ROOT/bin/gap.sh" "$DESTDIR_GAP_ROOT/doc/make_doc" || \ - sdh_die "Failed to fix up hard-coded paths in GAP build tools." - # TODO: This seems unnecessary--we are already installing all of doc/ to # GAP_ROOT, which is necessary for some functionality in GAP to work. Do # we need this? Maybe doc/gap could just be a symlink to gap/doc?? diff --git a/build/pkgs/gap/spkg-legacy-uninstall b/build/pkgs/gap/spkg-legacy-uninstall index d17eb939eb7..a8e5c59e1fb 100755 --- a/build/pkgs/gap/spkg-legacy-uninstall +++ b/build/pkgs/gap/spkg-legacy-uninstall @@ -4,6 +4,8 @@ rm -rf "$SAGE_LOCAL/gap/gap-4."* rm -rf "$SAGE_SHARE/gap" rm -f "$SAGE_LOCAL/gap/latest" rm -f "$SAGE_LOCAL/bin/gap" +rm -f "$SAGE_LOCAL/bin/gac" -# Remove old libgap headers +# Remove old libgap headers and library rm -rf "$SAGE_LOCAL/include/gap" +rm -rf "$SAGE_LOCAL/lib/gap" diff --git a/build/pkgs/gap/spkg-prerm.in b/build/pkgs/gap/spkg-prerm.in deleted file mode 100644 index 661d92621fa..00000000000 --- a/build/pkgs/gap/spkg-prerm.in +++ /dev/null @@ -1,6 +0,0 @@ -# These generated files are placed in directory provided by the SPKG, so -# delete the generated files first so that their parent directories can be -# removed during installation -GAP_ROOT="$SAGE_LOCAL/share/gap" -rm -f "$GAP_ROOT/pkg/atlasrep/datagens/"*.* -rm -f "$GAP_ROOT/pkg/atlasrep/dataword/"*.* diff --git a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch b/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch deleted file mode 100644 index e45fe7d9c6f..00000000000 --- a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c -index 3bbdc45..7df699f 100644 ---- a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c -+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c -@@ -8,9 +8,8 @@ extern short sp[],**mat[],*psp[],**imcos[],**cpco[],lorb[], - short *cst,**cpst,***cdpst,**svptr,*cp,*rel; - short *spst,**pspst,**pptr,**cpptr,npt,nb,nph,nph2,npg,npg2, - rno,orno,coh_index,*invg; --FILE *ip,*op; - --void seeknln (void) { while (getc(ip)!='\n'); } -+void seeknln (FILE *ip) { while (getc(ip)!='\n'); } - - /* This program differs from most other permutation programs in that perms are - all stored in the single array sp. Schreier vectors are stored in the short -@@ -23,13 +22,14 @@ void seeknln (void) { while (getc(ip)!='\n'); } - int - crprog1 (void) - { short *pc,*qc,ex,neg; int x; -+ FILE *ip,*op; - short i,j,k,l,m,n,cl,rl,*p,ocl,im,pt,pt1,pn,ipt; - if ((ip=fopen(inf2,"r"))== 0) - { fprintf(stderr,"Cannot open %s.\n",inf2); return(-1);} - fscanf(ip,"%hd%hd%hd%hd",&npt,&nph,&nb,&k); - if (nb>=mb) {fprintf(stderr,"nb too big. Increase MB.\n"); return(-1);} - if (k<=2) {fprintf(stderr,"inf2 has illegal format.\n"); return(-1); } -- seeknln(); seeknln(); -+ seeknln(ip); seeknln(ip); - for (i=1;i<=nb;i++) fscanf(ip,"%hd",lorb+i); - pptr=psp-1; pspst=psp+nph; svptr=cpsp-1; cpst=cpsp+nb; - invg=sp; nph2=2*nph; spst=sp+nph2; -@@ -37,7 +37,7 @@ crprog1 (void) - { pptr[i]=spst+(i-1)*npt-1; p=pptr[i]; - for (j=1;j<=npt;j++) {fscanf(ip,"%hd",&k); p[k]=j; } - invg[2*i-2]=2*i-1; invg[2*i-1]=2*i-2; -- seeknln(); -+ seeknln(ip); - } - spst+=(npt*nph); - for (i=1;i<=nb;i++) -@@ -75,7 +75,7 @@ crprog1 (void) - strcpy(inf1,inf0); strcat(inf1,".rel"); - if ((ip=fopen(inf1,"r"))==0) - { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1);} -- fscanf(ip,"%hd%hd",&k,&rno); seeknln(); -+ fscanf(ip,"%hd%hd",&k,&rno); seeknln(ip); - op=fopen(outft,"w"); - /* Now we have read everything in, and the computation can start */ - orno=0; -diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c -index a7396b2..658496f 100644 ---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c -+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c -@@ -20,8 +20,6 @@ short mexp=MEXP,mcl=MCL,no,rel[RSP],wt[MEXP],exp,*rpf,*rpb, - extern short prime,dim,*spv,**spm,mspace[],*vec[],**mat[],cp[],pinv[],opmats, - mm,mv; - extern int msp; --FILE *ip,*op; -- - - int - calcmats (void) -@@ -59,7 +57,7 @@ calcmats (void) - } - for (i=1;i<=exp;i++) trans(mat[i+exp],mat[i]); - if (opmats) -- { op=fopen(outf,"w"); -+ { FILE *op=fopen(outf,"w"); - fprintf(op,"%4d%4d%4d\n",prime,dim,exp); - for (i=1;i<=exp;i++) printmat(mat[i]); - fclose(op); -@@ -71,6 +69,7 @@ int - rdmats (void) - /* reads matrices of generators of P */ - { short i; int quot; -+ FILE *ip; - ip=fopen(inf4,"r"); - if (ip==0) - { fprintf(stderr,"Cannot open %s\n ",inf4); return(-1); } -@@ -90,12 +89,12 @@ rdmats (void) - fclose(ip); - return(0); - } --FILE *ip; - - int - ingp (int inp) - /* Read in output of respcrun -s */ - { short i,j,k,l,m,*orpf,**pcp; -+ FILE *ip; - ip=fopen(inf3,"r"); - if (ip==0) { fprintf(stderr,"Cannot open %s\n",inf3); return(-1); } - fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&i,&no,&j,&m); -diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c -index 0896551..6841bc8 100644 ---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c -+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c -@@ -9,7 +9,6 @@ extern short intexp,mexp,mng,wksp, - spugen[],*tlintg[]; - extern int ptrsp,rsp; - short fac; --FILE *ip,*op; - - int - ingp (void) -@@ -18,6 +17,7 @@ ingp (void) - of nqrun, and tails are also read in. - */ - { short i,j,k,l,m,x,y,no,*orpf,*orpb,**pcp; char tails; -+ FILE *ip; - if ((ip=fopen(inf1,"r"))==0) - { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1); } - fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&nng,&no,&class,&m); -@@ -89,6 +89,7 @@ int - outgp (void) - /* The PCP is output, together with tails */ - { short i,k,l,**pcp,*b,*e,*c; -+ FILE *op; - op=fopen(outf,"w"); - fprintf(op,"%4d%4d%4d%4d%4d%4d\n",prime,exp,nng,exp,class,1); - for (i=1;i<=exp;i++) fprintf(op,"%4d",wt[i]); fprintf(op,"\n"); -@@ -379,7 +380,7 @@ restart: - nng--; mnng--; enexpnt--; - if (nng==0) - { if (gap) -- { op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n"); -+ { FILE *op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n"); - fclose(op); - printf("All new generators eliminated. Multiplier is trivial.\n"); - } -diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c -index 01cf914..0144883 100644 ---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c -+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c -@@ -9,7 +9,6 @@ extern short intexp,mng,mexp,wksp, - spugen[],*intg[],*imintg[],*tlintg[]; - extern int ptrsp,rsp; - short *wf,*wc; char norm; --FILE *ip,*op; - - /* The data structures for this program and for nqrun are similar. - d1 and d2 contain definitions of generators. (Def. comes from commutator -@@ -35,6 +34,7 @@ nqmprog (void) - { short i,j,k,l,m,d,*gi,*gj,*ti,*tj,cl,def,*ps,*pf,**dp,*nrpb,*p,*orpf,*orpb, - nb,np,k1,*rno,*covrel,**pgen,tdef,sgn; - char nt; -+ FILE *ip,*op; - if (ingp() == -1) {fprintf(stderr,"Input error.\n"); return(-1); } - eexpnt=expnt+exp; enexpnt=nexpnt+nng; - diff --git a/build/pkgs/gap_packages/patches/guava_leon_includes.patch b/build/pkgs/gap_packages/patches/guava_leon_includes.patch deleted file mode 100644 index cdcd19cc3e8..00000000000 --- a/build/pkgs/gap_packages/patches/guava_leon_includes.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/pkg/guava-3.15/src/leon/src/generate.c Sat Feb 29 09:02:10 2020 ---- b/pkg/guava-3.15/src/leon/src/generate.c Thu Sep 24 13:58:36 2020 -*************** -*** 115,120 **** ---- 115,122 ---- - #include "groupio.h" - #include "enum.h" - #include "storage.h" -+ #include "chbase.h" -+ #include "inform.h" - - #ifdef ALT_TIME_HEADER - #include "cputime.h" diff --git a/build/pkgs/gap_packages/spkg-install.in b/build/pkgs/gap_packages/spkg-install.in index 168e6b11532..6dff182a48f 100644 --- a/build/pkgs/gap_packages/spkg-install.in +++ b/build/pkgs/gap_packages/spkg-install.in @@ -1,4 +1,4 @@ -GAP_ROOT="$SAGE_LOCAL/share/gap" +GAP_ROOT="$SAGE_LOCAL/lib/gap" PKG_DIR="$GAP_ROOT/pkg" PKG_SRC_DIR="$(pwd)/src/pkg" @@ -11,33 +11,31 @@ cd "$PKG_SRC_DIR" # (GAP 4.8.6 still had it, but this is gone in 4.10) sdh_install \ - aclib-* \ - AutoDoc-* \ - corelg-* \ - crime-* \ + aclib \ + corelg \ + crime \ cryst \ crystcat \ - design-* \ + design \ gbnp \ - genss-* \ - hap-* \ - hapcryst-* \ - hecke-* \ - images-* \ - liealgdb-* \ - liepring-* \ - liering-* \ - loops-* \ - MapClass-* \ - polymaking-* \ - qpa-* \ - quagroup-* \ - radiroot-* \ - repsn-* \ - sla-* \ - sonata-* \ - Toric-* \ - utils-* \ + genss \ + hap \ + hapcryst \ + hecke \ + images \ + liealgdb \ + liepring \ + liering \ + loops \ + mapclass \ + polymaking \ + qpa \ + quagroup \ + repsn \ + singular \ + sla \ + sonata \ + toric \ "$PKG_DIR" install_compiled_pkg() @@ -45,27 +43,23 @@ install_compiled_pkg() local pkg="$1" # Install the bin/ dir (where compiled modules should end up) # under /lib/gap; we then symlink to it later - sdh_install bin "$SAGE_LOCAL/lib/gap/pkg/$pkg" + sdh_install * "$SAGE_LOCAL/lib/gap/pkg/$pkg" + # TODO: # Clean up any build artificts before installing the rest of the package # Also remove configure/Makefiles # Note: None, if any of the packages really have a proper install target - make clean # Works for some packages but not all - rm -rf bin/ - rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/ + #make clean # Works for some packages but not all + #rm -rf bin/ + #rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/ - # Create the bin/ symlink - ln -s "$SAGE_LOCAL/lib/gap/pkg/$pkg/bin" bin - - # Install the rest of the package files - sdh_install * "$PKG_DIR/$pkg" } # Build and install compiled packages: # # These packages have an old ./configure that take the GAP_ROOT as a positional # argument -for pkg in cohomolo-* crypting-* grape-* guava-* orb-* datastructures-* +for pkg in cohomolo crypting grape guava orb datastructures do echo "Building GAP package $pkg" CFLAGS="$CFLAGS -Wno-implicit-function-declaration" @@ -91,7 +85,7 @@ pararr=( " " " " "--with-external-planarity" "--with-external-libsemigroups" ) ############################################################################## parind=0 -for pkg in nq-* io-* digraphs-* semigroups-* +for pkg in nq io digraphs semigroups do echo "Building GAP package $pkg" cd "$PKG_SRC_DIR/$pkg" diff --git a/build/pkgs/libsemigroups/checksums.ini b/build/pkgs/libsemigroups/checksums.ini index 62c4268515f..4e13a36cb35 100644 --- a/build/pkgs/libsemigroups/checksums.ini +++ b/build/pkgs/libsemigroups/checksums.ini @@ -1,5 +1,5 @@ tarball=libsemigroups-VERSION.tar.gz -sha1=2b16c095cc5ffd3f77a71dfbf48cce188e054c03 -md5=7082cadcf7a195ccb93175cd72b6db95 -cksum=1501022358 +sha1=86375824b47ce4b0e23570122e873f67136d0c0a +md5=ff79ad5fbc8bfeb64d48faaf24106b98 +cksum=2845045455 upstream_url=https://github.com/libsemigroups/libsemigroups/releases/download/vVERSION/libsemigroups-VERSION.tar.gz diff --git a/build/pkgs/libsemigroups/package-version.txt b/build/pkgs/libsemigroups/package-version.txt index 9084fa2f716..f90b1afc082 100644 --- a/build/pkgs/libsemigroups/package-version.txt +++ b/build/pkgs/libsemigroups/package-version.txt @@ -1 +1 @@ -1.1.0 +2.3.2 diff --git a/build/pkgs/libsemigroups/spkg-install.in b/build/pkgs/libsemigroups/spkg-install.in index 2aaf0e99043..128b54d2f99 100644 --- a/build/pkgs/libsemigroups/spkg-install.in +++ b/build/pkgs/libsemigroups/spkg-install.in @@ -1,4 +1,4 @@ cd src -sdh_configure +sdh_configure --disable-eigen sdh_make sdh_make_install diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4 index d4d145defe3..6a85631f624 100644 --- a/build/pkgs/singular/spkg-configure.m4 +++ b/build/pkgs/singular/spkg-configure.m4 @@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [ AC_MSG_CHECKING([that Singular's help is working]) AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error occurred"` = x], [ AC_MSG_RESULT(yes) - dnl We have Singular. Now determine the shared library path on - dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL. - AS_CASE([$host_os], - [cygwin*], [dnl Nothing to do - ], - [dnl Use pkg-config to get singular's libdir while we're at it. As a - dnl moral compromise for using pkg-config, this ultimately allows us - dnl to pass an absolute path to dlopen(), which is the only approach - dnl that POSIX guarantees will work. - PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir]) - dnl The acl_shlibext variable is set in the top-level configure.ac. - AC_LANG_PUSH(C) - ORIG_LIBS="${LIBS}" - LIBS="${LIBS} -ldl" - AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)]) - LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}" - - dnl if we can dlopen() it, substitute the name for sage_conf; - dnl otherwise, fall back to using the SPKG. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL); - if (h == 0) { return 1; } else { return dlclose(h); }]] - )], [ - AC_MSG_RESULT(yes) - ], [ - dnl try Debian-specific name - LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}" - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL); - if (h == 0) { return 1; } else { return dlclose(h); }]] - )], [ - AC_MSG_RESULT(yes) - ], [ - AC_MSG_RESULT(no) - sage_spkg_install_singular=yes - ], [AC_MSG_RESULT(yes)]) - ], [AC_MSG_RESULT(yes)]) - - AC_LANG_POP() - LIBS="${ORIG_LIBS}" - ] - )], [ + ], [ AC_MSG_RESULT(no) sage_spkg_install_singular=yes ] @@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [ ]) ]) ]) -],[],[],[ - dnl Post-check phase - dnl We make the sage_conf substitutions here, because the "default" - dnl substitution needs to be made even if we skipped the system-Singular - dnl checks themselves. - AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [ - AS_CASE([$host_os], - [cygwin*], [dnl Nothing to do - ], - [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL - LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}" - ] - ) - ]) - - AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}") ]) diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in index 6cd28f558a8..d66bdb3d264 100644 --- a/pkgs/sage-conf/_sage_conf/_conf.py.in +++ b/pkgs/sage-conf/_sage_conf/_conf.py.in @@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage" OPENMP_CFLAGS = "@OPENMP_CFLAGS@" OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@" -# The full absolute path to the main Singular library. -LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL) - # Installation location of wheels. This is determined at configuration time # and does not depend on the installation location of sage-conf. SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels" diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst index c917338e444..182e74aad20 100644 --- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst +++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst @@ -139,12 +139,12 @@ string, which you can print:: X.1 1 1 1 1 1 1 1 1 1 1 1 1 1 X.2 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 X.3 2 . 2 -1 . 2 2 . . . -1 2 2 - X.4 3 -1 -1 . 1 -1 3 -1 1 -1 . -1 3 - X.5 3 -1 -1 . 1 3 -1 -1 -1 1 . -1 3 - X.6 3 1 -1 . -1 -1 3 1 -1 1 . -1 3 - X.7 3 1 -1 . -1 3 -1 1 1 -1 . -1 3 - X.8 3 -1 3 . -1 -1 -1 -1 1 1 . -1 3 - X.9 3 1 3 . 1 -1 -1 1 -1 -1 . -1 3 + X.4 3 -1 -1 . 1 3 -1 -1 -1 1 . -1 3 + X.5 3 1 -1 . -1 3 -1 1 1 -1 . -1 3 + X.6 3 -1 3 . -1 -1 -1 -1 1 1 . -1 3 + X.7 3 -1 -1 . 1 -1 3 -1 1 -1 . -1 3 + X.8 3 1 3 . 1 -1 -1 1 -1 -1 . -1 3 + X.9 3 1 -1 . -1 -1 3 1 -1 1 . -1 3 X.10 4 -2 . -1 . . . 2 . . 1 . -4 X.11 4 2 . -1 . . . -2 . . 1 . -4 X.12 6 . -2 . . -2 -2 . . . . 2 6 diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx index de5db985e0b..c83b9264e44 100644 --- a/src/sage/coding/codecan/autgroup_can_label.pyx +++ b/src/sage/coding/codecan/autgroup_can_label.pyx @@ -76,7 +76,7 @@ columns do share the same coloring:: ((1,), (2,), (3, 5, 4), - (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18)) + (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17)) We can also restrict the group action to linear isometries:: diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index a3ac3ca1547..bfb9f8696e8 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -465,27 +465,27 @@ def automorphism_group_gens(self, equivalence="semilinear"): 0 sage: C = codes.HammingCode(GF(4, 'z'), 3) sage: C.automorphism_group_gens() - ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2 + ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2 + Defn: z |--> z + 1), + ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z + 1), - ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2 - Defn: z |--> z), ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z)], 362880) sage: C.automorphism_group_gens(equivalence="linear") - ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2 + ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z), - ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2 + ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z), ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z)], 181440) sage: C.automorphism_group_gens(equivalence="permutational") - ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2 + ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z), - ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2 + ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z), - ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2 + ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z), ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z)], @@ -691,10 +691,10 @@ def _canonize(self, equivalence): sage: C_iso == aut_group_can_label.get_canonical_form() True sage: aut_group_can_label.get_autom_gens() - [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2 + [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2 + Defn: z |--> z + 1), + ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z + 1), - ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2 - Defn: z |--> z), ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z)] """ diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 239258cb42c..873f5017057 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -8813,7 +8813,7 @@ def _libgap_(self): sage: libgap(P) # optional - gap_packages sage: A = libgap(GF(2)).PosetAlgebra(P); A # optional - gap_packages - ]/]>, (1 generators)>> + ]/]>, (1 generator)>> sage: A.Dimension() # optional - gap_packages 13 """ diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py index 6b756bafc30..8ac99319bec 100644 --- a/src/sage/combinat/root_system/hecke_algebra_representation.py +++ b/src/sage/combinat/root_system/hecke_algebra_representation.py @@ -357,7 +357,7 @@ def Tw(self, word, signs=None, scalar=None): sage: q1, q2 = K.gens() sage: KW = W.algebra(K) sage: x = KW.an_element(); x - 123 + 3*32 + 2*3 + e + 123 + 3*2312 + 2*31 + e sage: T = KW.demazure_lusztig_operators(q1,q2) sage: T12 = T.Tw( (1,2) ) diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index b8a0bebab44..9bccba124c8 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None): sage: SGA.group() Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space) sage: SGA.an_element() - s1*s2*s3 + 3*s3*s2 + 2*s3 + 1 + s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1 The preferred way to construct the symmetric group algebra is to go through the usual ``algebra`` method:: diff --git a/src/sage/env.py b/src/sage/env.py index d1a87df74ce..b40411d6335 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -198,7 +198,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st 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")) -GAP_ROOT_DIR = var("GAP_ROOT_DIR", join(SAGE_SHARE, "gap")) +GAP_LIB_DIR = var("GAP_LIB_DIR", join(SAGE_LOCAL, "lib", "gap")) +GAP_SHARE_DIR = var("GAP_SHARE_DIR", join(SAGE_SHARE, "gap")) THEBE_DIR = var("THEBE_DIR", join(SAGE_SHARE, "thebe")) COMBINATORIAL_DESIGN_DATA_DIR = var("COMBINATORIAL_DESIGN_DATA_DIR", join(SAGE_SHARE, "combinatorial_designs")) CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona")) @@ -230,12 +231,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE")) SINGULAR_BIN = var("SINGULAR_BIN") or "Singular" -# The path to libSingular, to be passed to dlopen(). This will -# typically be set to an absolute path in sage_conf, but the relative -# fallback path here works on systems where dlopen() searches the -# system's library locations. -LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so") - # OpenMP OPENMP_CFLAGS = var("OPENMP_CFLAGS", "") OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "") @@ -256,81 +251,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd) -def _get_shared_lib_path(*libnames: str) -> Optional[str]: - """ - Return the full path to a shared library file installed in - ``$SAGE_LOCAL/lib`` or the directories associated with the - Python sysconfig. - - This can also be passed more than one library name (e.g. for cases where - some library may have multiple names depending on the platform) in which - case the first one found is returned. - - This supports most *NIX variants (in which ``lib.so`` is found - under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib`` - extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg.dll``, - or ``$SAGE_LOCAL/bin/cyg-*.dll`` for versioned DLLs). - - For distributions like Debian that use a multiarch layout, we also try the - multiarch lib paths (i.e. ``/usr/lib//``). - - This returns ``None`` if no matching library file could be found. - - EXAMPLES:: - - sage: from sage.env import _get_shared_lib_path - sage: "gap" in _get_shared_lib_path("gap") - True - sage: _get_shared_lib_path("an_absurd_lib") is None - True - - """ - - for libname in libnames: - search_directories: List[Path] = [] - patterns: List[str] = [] - if sys.platform == 'cygwin': - # Later down we take the first matching DLL found, so search - # SAGE_LOCAL first so that it takes precedence - if SAGE_LOCAL: - search_directories.append(Path(SAGE_LOCAL) / 'bin') - search_directories.append(Path(sysconfig.get_config_var('BINDIR'))) - # Note: The following is not very robust, since if there are multible - # versions for the same library this just selects one more or less - # at arbitrary. However, practically speaking, on Cygwin, there - # will only ever be one version - patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll'] - else: - if sys.platform == 'darwin': - ext = 'dylib' - else: - ext = 'so' - - if SAGE_LOCAL: - search_directories.append(Path(SAGE_LOCAL) / 'lib') - libdir = sysconfig.get_config_var('LIBDIR') - if libdir is not None: - libdir = Path(libdir) - search_directories.append(libdir) - - multiarchlib = sysconfig.get_config_var('MULTIARCH') - if multiarchlib is not None: - search_directories.append(libdir / multiarchlib), - - patterns = [f'lib{libname}.{ext}'] - - for directory in search_directories: - for pattern in patterns: - path = next(directory.glob(pattern), None) - if path is not None: - return str(path.resolve()) - - # Just return None if no files were found - return None - -# locate libgap shared object -GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", "")) - # post process if DOT_SAGE is not None and ' ' in DOT_SAGE: if UNAME[:6] == 'CYGWIN': diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py index a4b047113c5..86090b43535 100644 --- a/src/sage/groups/abelian_gps/abelian_group_gap.py +++ b/src/sage/groups/abelian_gps/abelian_group_gap.py @@ -338,7 +338,7 @@ def _element_constructor_(self, x, check=True): if isinstance(x, AbelianGroupElement_gap): try: if x in self._cover: - x = self.gap().NaturalHomomorphism().Image(x.gap()) + x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap()) else: x = x.gap() except AttributeError: @@ -1043,7 +1043,7 @@ def natural_homomorphism(self): From: Abelian group with gap, generator orders (4,) To: Quotient abelian group with generator orders (2,) """ - phi = self.gap().NaturalHomomorphism() + phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations) Hom = self._cover.Hom(self) return Hom(phi) diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py index 8d6e443683c..1beb01af87f 100644 --- a/src/sage/groups/finitely_presented.py +++ b/src/sage/groups/finitely_presented.py @@ -596,9 +596,9 @@ def gap(self): sage: k = G.rewriting_system() sage: k.gap() Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules - [ [ a^2, ], [ a*A, ], - [ A*a, ], [ b^2, ], - [ b*B, ], [ B*b, ] ] + [ [ a*A, ], [ A*a, ], + [ b*B, ], [ B*b, ], + [ a^2, ], [ b^2, ] ] """ return self._gap diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py index 7fc4dbe7548..e5eccd45942 100644 --- a/src/sage/groups/fqf_orthogonal.py +++ b/src/sage/groups/fqf_orthogonal.py @@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup): [2/3 0 0] [ 0 2/3 0] [ 0 0 4/3] - generated by 2 elements + generated by 3 elements sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4]) sage: T = TorsionQuadraticForm(q) sage: T.orthogonal_group().order() diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx index d25121aa792..dc81b71635b 100644 --- a/src/sage/groups/libgap_wrapper.pyx +++ b/src/sage/groups/libgap_wrapper.pyx @@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize its output via LibGAP:: sage: FooGroup() - + sage: type(FooGroup().gap()) @@ -106,7 +106,7 @@ class ParentLibGAP(SageObject): ....: ParentLibGAP.__init__(self, lg) ....: Group.__init__(self) sage: FooGroup() - + """ def __init__(self, libgap_parent, ambient=None): @@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): ....: ParentLibGAP.__init__(self, lg) ....: Group.__init__(self) sage: FooGroup() - + sage: FooGroup().gens() (f1,) """ diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py index e177b180840..fd4eff2e34e 100644 --- a/src/sage/groups/matrix_gps/finitely_generated.py +++ b/src/sage/groups/matrix_gps/finitely_generated.py @@ -563,9 +563,6 @@ def as_permutation_group(self, algorithm=None, seed=None): 21499084800 sage: P = G.as_permutation_group() sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6) - sage: P == Psmaller # see the note below - True - sage: Psmaller = G.as_permutation_group(algorithm="smaller") sage: P == Psmaller False sage: P.cardinality() diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx index f2ccca042ac..47d6862333c 100644 --- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx +++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx @@ -427,7 +427,7 @@ cdef class LabelledBranching: sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching sage: L = LabelledBranching(3) sage: L.small_generating_set() - [] + [()] sage: L.add_gen(libgap.eval('(1,2,3)')) sage: L.small_generating_set() [(1,2,3)] diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index a7372d3d77e..3873e620965 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -926,7 +926,7 @@ def _coerce_map_from_(self, G): sage: f = PG._coerce_map_from_(MG) sage: mg = MG.an_element() sage: p = f(mg); p - (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60) + (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21) sage: PG(p._gap_()) == p True @@ -972,12 +972,12 @@ def _coerce_map_from_(self, G): sage: P = G.as_permutation_group(algorithm='smaller', seed=5) sage: P1 = G.as_permutation_group() sage: P == P1 - False + True sage: g1, g2, g3 = G.gens() sage: P(g1*g2) - (1,3,7,12)(2,4,8,10)(5,11)(6,9) + (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17) sage: P1(g1*g2) - (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66) + (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17) Another check for :trac:`5583`:: @@ -1302,7 +1302,7 @@ def gens_small(self): sage: G.gens_small() # random [('b','c'), ('a','c','b')] ## (on 64-bit Linux) [('a','b'), ('a','c','b')] ## (on Solaris) - sage: len(G.gens_small()) == 2 + sage: len(G.gens_small()) == 2 # random True """ gens = self._libgap_().SmallGeneratingSet() @@ -4370,17 +4370,23 @@ def is_transitive(self, domain=None): :: - sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5] - sage: G.is_transitive([1,4,5]) + sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]]) + sage: G.is_transitive([1,2,3,4,5]) True - sage: G.is_transitive([2..6]) + sage: G.is_transitive([1..7]) False sage: G.is_transitive(G.non_fixed_points()) - True + False sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]]) sage: H.is_transitive(H.non_fixed_points()) False + If `G` does not act on the domain, it always returns ``False``:: + + sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5] + sage: G.is_transitive([1,4,5]) + False + Note that this differs from the definition in GAP, where ``IsTransitive`` returns whether the group is transitive on the set of points moved by the group. @@ -4436,12 +4442,16 @@ def is_primitive(self, domain=None): sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]]) sage: G.is_primitive([1..4]) False - sage: G.is_primitive([1,2,3]) - True sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6] sage: G.is_primitive(G.non_fixed_points()) True + If `G` does not act on the domain, it always returns ``False``:: + + sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]]) + sage: G.is_primitive([1,2,3]) + False + """ #If the domain is not a subset of self.domain(), then the #action isn't primitive. diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py index a38d2bd6d02..a890d0acec1 100644 --- a/src/sage/interfaces/gap.py +++ b/src/sage/interfaces/gap.py @@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False): """ # Create new workspace with filename WORKSPACE g = Gap(use_workspace_cache=False, max_workspace_size=None) + g.eval('ColorPrompt(false)') + g.eval('SetUserPreference("UseColorPrompt", false)') g.eval('SetUserPreference("HistoryMaxLines", 30)') from sage.tests.gap_packages import all_installed_packages for pkg in all_installed_packages(gap=g): diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py index 33a87dd5076..03b40be6856 100644 --- a/src/sage/interfaces/gap_workspace.py +++ b/src/sage/interfaces/gap_workspace.py @@ -16,7 +16,8 @@ import os import time import hashlib -from sage.env import DOT_SAGE, GAP_SO +import subprocess +from sage.env import DOT_SAGE, HOSTNAME, GAP_LIB_DIR, GAP_SHARE_DIR def gap_workspace_file(system="gap", name="workspace", dir=None): @@ -59,11 +60,13 @@ def gap_workspace_file(system="gap", name="workspace", dir=None): if dir is None: dir = os.path.join(DOT_SAGE, 'gap') - if GAP_SO: - h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest() - else: - h = 'unknown' - return os.path.join(dir, '%s-%s-%s' % (system, name, h)) + data = f'{GAP_LIB_DIR}:{GAP_SHARE_DIR}' + for path in GAP_LIB_DIR, GAP_SHARE_DIR: + sysinfo = os.path.join(path, "sysinfo.gap") + if os.path.exists(sysinfo): + data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"') + h = hashlib.sha1(data.encode('utf-8')).hexdigest() + return os.path.join(dir, f'{system}-{name}-{HOSTNAME}-{h}') def prepare_workspace_dir(dir=None): diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index c555ea0333c..e3db3934baf 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj): """ cdef Obj s, stream, output_text_string cdef UInt res + cdef TypOutputFile output # The only way to get a string representation of an object that is truly # consistent with how it would be represented at the GAP REPL is to call # ViewObj on it. Unfortunately, ViewObj *prints* to the output stream, @@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj): output_text_string = GAP_ValueGlobalVariable("OutputTextString") stream = CALL_2ARGS(output_text_string, s, GAP_True) - if not OpenOutputStream(stream): + if not OpenOutputStream(&output, stream): raise GAPError("failed to open output capture stream for " "representing GAP object") CALL_1ARGS(func, obj) - CloseOutput() + CloseOutput(&output) return CSTR_STRING(s) finally: GAP_Leave() diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd index 6d22e32540b..6111d18a5c7 100644 --- a/src/sage/libs/gap/gap_includes.pxd +++ b/src/sage/libs/gap/gap_includes.pxd @@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil: cdef extern from "gap/io.h" nogil: - UInt OpenOutputStream(Obj stream) - UInt CloseOutput() + ctypedef struct TypOutputFile: + pass + UInt OpenOutputStream(TypOutputFile* output, Obj stream) + UInt CloseOutput(TypOutputFile* output) cdef extern from "gap/libgap-api.h" nogil: diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx index b1a64e57939..6a36613aa8c 100644 --- a/src/sage/libs/gap/libgap.pyx +++ b/src/sage/libs/gap/libgap.pyx @@ -695,7 +695,7 @@ class Gap(Parent): sage: libgap.List sage: libgap.GlobalRandomSource - + """ if name in dir(self.__class__): return getattr(self.__class__, name) diff --git a/src/sage/libs/gap/saved_workspace.py b/src/sage/libs/gap/saved_workspace.py index ad5adec36d0..7636707f557 100644 --- a/src/sage/libs/gap/saved_workspace.py +++ b/src/sage/libs/gap/saved_workspace.py @@ -8,7 +8,7 @@ import os import glob -from sage.env import GAP_ROOT_DIR +from sage.env import GAP_LIB_DIR from sage.interfaces.gap_workspace import gap_workspace_file @@ -31,7 +31,7 @@ def timestamp(): """ libgap_dir = os.path.dirname(__file__) libgap_files = glob.glob(os.path.join(libgap_dir, '*')) - gap_packages = glob.glob(os.path.join(GAP_ROOT_DIR, 'pkg', '*')) + gap_packages = glob.glob(os.path.join(GAP_LIB_DIR, 'pkg', '*')) files = libgap_files + gap_packages if len(files) == 0: print('Unable to find LibGAP files.') diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx index 344ab88c42a..eaa659d64c7 100644 --- a/src/sage/libs/gap/util.pyx +++ b/src/sage/libs/gap/util.pyx @@ -13,7 +13,7 @@ Utility functions for GAP #***************************************************************************** from libc.signal cimport signal, SIGCHLD, SIG_DFL -from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL +from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL from cpython.exc cimport PyErr_Fetch, PyErr_Restore from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE @@ -164,33 +164,6 @@ cdef void gasman_callback() with gil: ### Initialization of GAP ################################################## ############################################################################ -def gap_root(): - """ - Find the location of the GAP root install which is stored in the gap - startup script. - - EXAMPLES:: - - sage: from sage.libs.gap.util import gap_root - sage: gap_root() # random output - '/home/vbraun/opt/sage-5.3.rc0/local/gap/latest' - """ - if os.path.exists(sage.env.GAP_ROOT_DIR): - return sage.env.GAP_ROOT_DIR - - # Attempt to figure out the appropriate GAP_ROOT by reading the - # local/bin/gap shell script; this is an ugly hack that exists for - # historical reasons; the best approach to setting where Sage looks for - # the appropriate GAP_ROOT is to set the GAP_ROOT_DIR variable - SAGE_LOCAL = sage.env.SAGE_LOCAL - with open(os.path.join(SAGE_LOCAL, 'bin', 'gap')) as f: - gap_sh = f.read().splitlines() - gapdir = next(x for x in gap_sh if x.strip().startswith('GAP_ROOT')) - gapdir = gapdir.split('"')[1] - gapdir = gapdir.replace('$SAGE_LOCAL', SAGE_LOCAL) - return gapdir - - # To ensure that we call initialize_libgap only once. cdef bint _gap_is_initialized = False @@ -232,12 +205,12 @@ cdef initialize(): # this isn't portable cdef void* handle - libgapname = str_to_bytes(sage.env.GAP_SO) - handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL) + # reload the current module to force reload of libgap (see #33446) + lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape") + handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY) if handle is NULL: - raise RuntimeError( - "Could not dlopen() libgap even though it should already " - "be loaded!") + err = dlerror() + raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})") dlclose(handle) # Define argv variable, which we will pass in to @@ -245,7 +218,7 @@ cdef initialize(): cdef char* argv[16] argv[0] = "sage" argv[1] = "-l" - s = str_to_bytes(gap_root(), FS_ENCODING, "surrogateescape") + s = str_to_bytes(sage.env.GAP_LIB_DIR + ";" + sage.env.GAP_SHARE_DIR, FS_ENCODING, "surrogateescape") argv[2] = s argv[3] = "-m" @@ -362,15 +335,9 @@ cdef Obj gap_eval(str gap_string) except? NULL: GAPError: Error, Variable: 'Complex' must have a value Syntax error: ; expected in stream:1 Complex Field with 53 bits of precision;; - ^^^^^^^^^^^^ + ^^^^^ Error, Variable: 'with' must have a value - Syntax error: ; expected in stream:1 - Complex Field with 53 bits of precision;; - ^^^^^^^^^^^^^^^^^^^^ Error, Variable: 'bits' must have a value - Syntax error: ; expected in stream:1 - Complex Field with 53 bits of precision;; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error, Variable: 'precision' must have a value Test that on a subsequent attempt we get the same message (no garbage was diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx index 3eb4db32dab..cc0797d064a 100644 --- a/src/sage/libs/singular/singular.pyx +++ b/src/sage/libs/singular/singular.pyx @@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v): cdef extern from *: # hack to get at cython macro int unlikely(int) -cdef extern from "dlfcn.h": - void *dlopen(char *, long) - char *dlerror() - void dlclose(void *handle) - -cdef extern from "dlfcn.h": - cdef long RTLD_LAZY - cdef long RTLD_GLOBAL +from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL cdef int overflow_check(unsigned long e, ring *_ring) except -1: """ @@ -1768,8 +1761,6 @@ cdef init_libsingular(): cdef void *handle = NULL - from sage.env import LIBSINGULAR_PATH - lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape") # This is a workaround for https://github.com/Singular/Singular/issues/1113 # and can be removed once that fix makes it into release of Singular that @@ -1786,10 +1777,12 @@ cdef init_libsingular(): import platform if not platform.system().startswith("CYGWIN"): + # reload the current module to force reload of libSingular (see #33446) + lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape") handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY) if not handle: err = dlerror() - raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})") + raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})") # load SINGULAR siInit(lib) diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py index 2e4518ca226..c302b169b8a 100644 --- a/src/sage/tests/gap_packages.py +++ b/src/sage/tests/gap_packages.py @@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None): sage: from sage.tests.gap_packages import all_installed_packages sage: all_installed_packages() - (...'GAPDoc'...) + (...'gapdoc'...) sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True) True """