[pytango] 302/483: git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk at 24231 4e9c00fd-8f2e-0410-aa12-93ce3db5e235

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit e109437676279e06e6693654591ccb5c6b7efc7d
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Fri Nov 15 20:55:31 2013 +0000

    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@24231 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 src/boost/python/ipython/ipython_10_00/__init__.py |  18 ++++
 .../python/ipython/ipython_10_00/ipy_install.py    | 101 +++++++++++++++++++++
 .../ipython_10_00.py                               |   0
 3 files changed, 119 insertions(+)

diff --git a/src/boost/python/ipython/ipython_10_00/__init__.py b/src/boost/python/ipython/ipython_10_00/__init__.py
new file mode 100644
index 0000000..587afd6
--- /dev/null
+++ b/src/boost/python/ipython/ipython_10_00/__init__.py
@@ -0,0 +1,18 @@
+# -----------------------------------------------------------------------------
+# This file is part of PyTango (http://www.tinyurl.com/PyTango)
+#
+# Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
+# Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
+#
+# Distributed under the terms of the GNU Lesser General Public License,
+# either version 3 of the License, or (at your option) any later version.
+# See LICENSE.txt for more info.
+# -----------------------------------------------------------------------------
+
+__all__ = ['load_ipython_extension', 'unload_ipython_extension', 'load_config',
+           'run', 'install', 'is_installed']
+
+from .ipython_10_00 import load_ipython_extension, unload_ipython_extension, \
+    load_config, run
+from .ipy_install import install, is_installed
+
diff --git a/src/boost/python/ipython/ipython_10_00/ipy_install.py b/src/boost/python/ipython/ipython_10_00/ipy_install.py
new file mode 100644
index 0000000..d246cb9
--- /dev/null
+++ b/src/boost/python/ipython/ipython_10_00/ipy_install.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+
+# -----------------------------------------------------------------------------
+# This file is part of PyTango (http://www.tinyurl.com/PyTango)
+#
+# Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
+# Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
+#
+# Distributed under the terms of the GNU Lesser General Public License,
+# either version 3 of the License, or (at your option) any later version.
+# See LICENSE.txt for more info.
+# -----------------------------------------------------------------------------
+
+from __future__ import with_statement
+
+import sys
+import os
+import io
+
+import IPython
+from IPython.core.profiledir import ProfileDirError, ProfileDir
+from IPython.core.application import BaseIPythonApplication
+from IPython.utils.path import get_ipython_dir
+from IPython.utils.io import ask_yes_no
+
+import PyTango
+
+
+__PROFILE = """\
+#!/usr/bin/env ipython
+\"\"\"An automaticaly generated IPython profile designed to provide a user 
+friendly interface to Tango.
+Created with PyTango {pytangover} for IPython {ipyver}\"\"\"
+
+import PyTango.ipython
+
+config = get_config()
+PyTango.ipython.load_config(config)
+
+# Put any additional environment here
+"""
+
+_CONFIG_FILE_NAME = 'ipython_config.py'
+
+def is_installed(ipydir=None, profile='tango'):
+    ipython_dir = ipydir or get_ipython_dir()
+    try:
+        p_dir = ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
+    except ProfileDirError:
+        return False
+    abs_config_file_name = os.path.join(p_dir.location, _CONFIG_FILE_NAME)
+    return os.path.isfile(abs_config_file_name)
+
+def install(ipydir=None, verbose=True, profile='tango'):
+    if verbose:
+        out = sys.stdout
+    else:
+        out = io.BytesIO()
+    
+    ipython_dir = ipydir or get_ipython_dir()
+    try:
+        p_dir = ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
+    except ProfileDirError:
+        p_dir = ProfileDir.create_profile_dir_by_name(ipython_dir, profile)
+    abs_config_file_name = os.path.join(p_dir.location, _CONFIG_FILE_NAME)
+    create_config = True
+    if os.path.isfile(abs_config_file_name):
+        create_config = ask_yes_no("Tango configuration file already exists. "\
+                                   "Do you wish to replace it?", default='y')
+    
+    if not create_config:
+        return
+
+    out.write("Installing tango extension to ipython... ")
+    out.flush()
+
+    profile = __PROFILE.format(pytangover=PyTango.Release.version,
+                               ipyver=IPython.release.version)
+    with open(abs_config_file_name, "w") as f:
+        f.write(profile)
+        f.close()
+    out.write("[DONE]\n\n")
+    out.write("""\
+To start ipython with tango interface simply type on the command line:
+%% ipython --profile=tango
+
+For more information goto:
+http://www.tango-controls.org/static/PyTango/latest/doc/html/
+
+Have fun with ITango!
+The PyTango team
+""")
+    
+def main():
+    d = None
+    if len(sys.argv) > 1:
+        d = sys.argv[1]
+    install(d)
+    
+if __name__ == "__main__":
+    main()
diff --git a/src/boost/python/ipython/ipython_00_11/ipython_10_00.py b/src/boost/python/ipython/ipython_10_00/ipython_10_00.py
similarity index 100%
rename from src/boost/python/ipython/ipython_00_11/ipython_10_00.py
rename to src/boost/python/ipython/ipython_10_00/ipython_10_00.py

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list