Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
gappy PR#17 patch; uses it to handle workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpase committed Sep 6, 2021
1 parent 69feb67 commit 1b5adee
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions build/pkgs/gappy/patches/ws_valid.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/gappy/core.pyx b/gappy/core.pyx
index 0048511..8a80964 100644
--- a/gappy/core.pyx
+++ b/gappy/core.pyx
@@ -200,7 +200,7 @@ MakeImmutable(\$GAPPY_ERROUT);


# TODO: Change autoload=True by default
-cdef initialize(gap_root=None, gaprc=None, workspace=None, autoload=False):
+cdef initialize(gap_root=None, gaprc=None, workspace=None, workspace_valid=False, autoload=False):
"""
Initialize the GAP library, if it hasn't already been initialized.

@@ -246,7 +246,7 @@ cdef initialize(gap_root=None, gaprc=None, workspace=None, autoload=False):
argv[argc] = '-A'
argc += 1

- if workspace is not None:
+ if workspace_valid:
# Try opening the workspace file, raising the appropriate OSError
# if not found/readable
workspace = os.path.normpath(workspace)
@@ -605,12 +605,13 @@ cdef class Gap:
gap_root=self._init_kwargs['gap_root'],
gaprc=self._init_kwargs['gaprc'],
workspace=self._init_kwargs['workspace'],
+ workspace_valid=self._init_kwargs['workspace_valid'],
autoload=self._init_kwargs['autoload']
))
_gap_instance = self
return True

- def __init__(self, gap_root=None, gaprc=None, workspace=None,
+ def __init__(self, gap_root=None, gaprc=None, workspace=None, workspace_valid=False,
autoinit=False, autoload=False):
if _gap_is_initialized:
raise RuntimeError(
@@ -621,6 +622,7 @@ cdef class Gap:
'gap_root': gap_root,
'gaprc': gaprc,
'workspace': workspace,
+ 'workspace_valid': workspace_valid,
'autoload': autoload
})

4 changes: 2 additions & 2 deletions src/sage/libs/gap/libgap.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ cdef class SageGap(Gap):
"""

def __init__(self):
workspace, _ = get_workspace()
Gap.__init__(self, gap_root=gap_root(), workspace=workspace,
workspace, isitthere = get_workspace()
Gap.__init__(self, gap_root=gap_root(), workspace=workspace, workspace_valid=isitthere,
autoload=True)

cpdef initialize(self):
Expand Down

0 comments on commit 1b5adee

Please sign in to comment.