|
|
3c6a797 |
--- ./ipbori/ipythonrc-polybori.orig 2011-09-05 17:11:22.000000000 -0600
|
|
|
3c6a797 |
+++ ./ipbori/ipythonrc-polybori 2011-09-07 15:40:52.223977416 -0600
|
|
|
3c6a797 |
@@ -21,20 +21,6 @@
|
|
|
3c6a797 |
# PolyBoRi path (either set by wrapper or assumed to be the parent directory)
|
|
|
3c6a797 |
# Note: change "execute pbdir = '..'", if you manually install this profile
|
|
|
3c6a797 |
execute from os import environ as env
|
|
|
3c6a797 |
-execute from os import path as os_path
|
|
|
3c6a797 |
-execute pbdir = '..'
|
|
|
3c6a797 |
-execute if 'PBDIR' in env.keys(): pbdir = env['PBDIR']
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-execute ipbdir = os_path.join(pbdir, 'ipbori')
|
|
|
3c6a797 |
-execute if 'IPBDIR' in env.keys(): pbdir = env['IPBDIR']
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-# Get program name and prompt something
|
|
|
3c6a797 |
-execute ipbname = 'ipbori'
|
|
|
3c6a797 |
-execute if 'IPBNAME' in env.keys(): ipbname = env['IPBNAME']
|
|
|
3c6a797 |
-execute print ipbname, "-- PolyBoRi's interactive command line tool"
|
|
|
3c6a797 |
-execute print 'Type "polybori_copyright()" or "polybori_license()"',
|
|
|
3c6a797 |
-execute print 'for more information.\n'
|
|
|
3c6a797 |
|
|
|
3c6a797 |
# Uncomment, if we want to skip the banner
|
|
|
3c6a797 |
# banner 0
|
|
|
3c6a797 |
@@ -42,26 +28,17 @@
|
|
|
3c6a797 |
# Include base config from current IPYTHONDIR and only add some extras
|
|
|
3c6a797 |
include ipythonrc
|
|
|
3c6a797 |
|
|
|
3c6a797 |
-# Append the PolyBoRi application directory to current search path
|
|
|
3c6a797 |
-execute from sys import path
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-# The following string may be changed by install. If not installed, use default.
|
|
|
3c6a797 |
-execute relpyroot = '$RELATIVEPYPREFIX'
|
|
|
3c6a797 |
-execute if relpyroot[0] == '$': relpyroot = '../pyroot'
|
|
|
3c6a797 |
-execute pyroot = os_path.join(ipbdir, relpyroot)
|
|
|
3c6a797 |
-execute path.insert(0, pyroot)
|
|
|
3c6a797 |
+# execute PolyBoRi settings
|
|
|
3c6a797 |
+execut from os import environ as env
|
|
|
3c6a797 |
+execute exec(env["IPBORI_INIT_CMDS"])
|
|
|
3c6a797 |
+execute print ''
|
|
|
3c6a797 |
|
|
|
3c6a797 |
# Get all basic stuff from PyPolyBoRi
|
|
|
3c6a797 |
execute from polybori.PyPolyBoRi import *
|
|
|
3c6a797 |
-execute r = Ring(10000)
|
|
|
3c6a797 |
-execute x = Variable
|
|
|
3c6a797 |
|
|
|
3c6a797 |
# Get all-inclusive groebner routine
|
|
|
3c6a797 |
execute from polybori.gbcore import groebner_basis
|
|
|
3c6a797 |
|
|
|
3c6a797 |
-# Import some high-level modelling functionality
|
|
|
3c6a797 |
-execute from polybori import *
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
execute pb_copy = "Copyright (c) 2007-2010 by The PolyBoRi Team.\n"
|
|
|
3c6a797 |
execute pb_copy += " Michael Brickenstein (MFO) brickenstein@mfo.de\n"
|
|
|
3c6a797 |
execute pb_copy += " Alexander Dreyer (ITWM) "
|
|
|
3c6a797 |
@@ -90,9 +67,3 @@
|
|
|
3c6a797 |
|
|
|
3c6a797 |
execute def polybori_copyright(): print pb_copy
|
|
|
3c6a797 |
execute def polybori_license(): print pb_lic
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-# Get special stuff for this user interface
|
|
|
3c6a797 |
-execute from polybori.frontend import *
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-# Simplify ring declaration
|
|
|
3c6a797 |
-execute def declare_ring(arg1, arg2 = None): return ternary_declare_ring(arg1, arg2, globals())
|
|
|
3c6a797 |
--- ./ipbori/ipbori.orig 2011-09-05 17:11:22.000000000 -0600
|
|
|
3c6a797 |
+++ ./ipbori/ipbori 2011-09-07 15:27:58.534959479 -0600
|
|
|
3c6a797 |
@@ -65,5 +65,23 @@
|
|
|
3c6a797 |
# installing the profile, but custom settings like IPYTHONDIR/ipythonrc are
|
|
|
3c6a797 |
# still available.
|
|
|
3c6a797 |
# (For the latter, ipythonrc-polybori needs to import ipythonrc.)
|
|
|
3c6a797 |
-${IPYTHONPREFIX}ipython -rcfile ${IPBDIR}/ipythonrc-polybori $@
|
|
|
3c6a797 |
+#${IPYTHONPREFIX}ipython -rcfile ${IPBDIR}/ipythonrc-polybori $@
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+export PBORI_SITE="pyroot/"
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+# Note: $PBORI_SITE is replaced on installation with relative path
|
|
|
3c6a797 |
+# to the PolyBoRi python site
|
|
|
3c6a797 |
+export IPBORI_INIT_CMDS="import sys; sys.path.insert(0, '$PBDIR/$PBORI_SITE');\
|
|
|
3c6a797 |
+from polybori.frontend import *; polybori_start(globals())"
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+IPYTHON=${IPYTHONPREFIX}ipython
|
|
|
3c6a797 |
|
|
|
3c6a797 |
+# RCfiles are supported up to ipython 0.11
|
|
|
3c6a797 |
+if [[ `$IPYTHON --c="import IPython; \
|
|
|
3c6a797 |
+ ([eval(elt) for elt in IPython.__version__.split('.')[:2] ]< [0, 11]) "\
|
|
|
3c6a797 |
+ -quick` =~ "True" ]]
|
|
|
3c6a797 |
+then
|
|
|
3c6a797 |
+ ${IPYTHON} -rcfile ${IPBDIR}/ipythonrc-polybori $@
|
|
|
3c6a797 |
+else
|
|
|
3c6a797 |
+ ${IPYTHON} --c="print'';$IPBORI_INIT_CMDS" --i
|
|
|
3c6a797 |
+fi
|
|
|
3c6a797 |
--- ./pyroot/polybori/frontend.py.orig 2011-09-05 17:11:22.000000000 -0600
|
|
|
3c6a797 |
+++ ./pyroot/polybori/frontend.py 2011-09-07 15:44:38.499331854 -0600
|
|
|
3c6a797 |
@@ -1,15 +1,7 @@
|
|
|
3c6a797 |
+# Import basic functionality
|
|
|
3c6a797 |
+from polybori import *
|
|
|
3c6a797 |
from polybori.blocks import declare_ring as orig_declare_ring
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-def ternary_declare_ring(blocks, context, global_context):
|
|
|
3c6a797 |
- """This is just a wrapper fpr declare_ring, which selects context, if it is
|
|
|
3c6a797 |
- not None and global_context otherwise."""
|
|
|
3c6a797 |
- if context is None:
|
|
|
3c6a797 |
- context = global_context
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
- return orig_declare_ring(blocks, context)
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
-
|
|
|
3c6a797 |
+from os import environ as env, path as os_path
|
|
|
3c6a797 |
|
|
|
3c6a797 |
def block_scheme_names(blocks):
|
|
|
3c6a797 |
"""Helper for Singular interface."""
|
|
|
3c6a797 |
@@ -19,3 +11,21 @@
|
|
|
3c6a797 |
declare_block_scheme(blocks, context)
|
|
|
3c6a797 |
|
|
|
3c6a797 |
return context.keys()
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+ipbname = 'ipbori'
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+def polybori_start(global_context):
|
|
|
3c6a797 |
+ def declare_ring(blocks, context=None):
|
|
|
3c6a797 |
+ if context is None:
|
|
|
3c6a797 |
+ context = global_context
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+ return orig_declare_ring(blocks, context)
|
|
|
3c6a797 |
+ declare_ring.__doc__ = orig_declare_ring.__doc__
|
|
|
3c6a797 |
+ global_context["declare_ring"] = declare_ring
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+ print ipbname + """ -- PolyBoRi's interactive command line tool
|
|
|
3c6a797 |
+Type "polybori_copyright()" or "polybori_license()" for more information."""
|
|
|
3c6a797 |
+
|
|
|
3c6a797 |
+# Here come the defaults
|
|
|
3c6a797 |
+r = Ring(10000)
|
|
|
3c6a797 |
+x = Variable
|