[pytango] 130/483: preparing ipython
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:33 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 5a3e969af1d2d9918a59ca05a4bd8f30168d4339
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Wed Sep 5 11:33:17 2012 +0000
preparing ipython
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@21085 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
MANIFEST.in | 3 +-
PyTango/ipython/__init__.py | 18 +--
PyTango/ipython/ipython_00_10/__init__.py | 4 +-
PyTango/ipython/ipython_00_10/ipy_install.py | 12 +-
PyTango/ipython/ipython_00_10/ipython_00_10.py | 15 +++
PyTango/ipython/ipython_00_11/__init__.py | 6 +-
PyTango/ipython/ipython_00_11/ipy_install.py | 16 ++-
PyTango/ipython/ipython_00_11/ipython_00_11.py | 145 ++++++++++++++-------
PyTango/ipython/ipython_00_12/ipython_00_12.py | 118 -----------------
doc/itango/highlights.rst | 1 -
doc/itango/index.rst | 12 +-
doc/man/itango.1 | 50 +++++++
doc/revision.rst | 1 +
.../ipython_00_12/__init__.py => scripts/itango | 20 ++-
setup.cfg | 2 +-
setup.py | 29 ++++-
16 files changed, 251 insertions(+), 201 deletions(-)
diff --git a/MANIFEST.in b/MANIFEST.in
index b273356..6c632d8 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,5 @@
recursive-include PyTango *.py
-recursive-include PyTango3 *.py
+recursive-include cPyTango *.py
recursive-include IPython *.py
recursive-include win *.sln *.vcproj
@@ -7,6 +7,7 @@ include winsetup.py
graft src
graft doc
+graft tests
global-exclude *.pyc
global-exclude *.pyo
diff --git a/PyTango/ipython/__init__.py b/PyTango/ipython/__init__.py
index 6083913..6b74895 100644
--- a/PyTango/ipython/__init__.py
+++ b/PyTango/ipython/__init__.py
@@ -49,20 +49,22 @@ if ipv >= [0, 10] and ipv < [0, 11]:
from . import ipython_00_10
init_ipython = ipython_00_10.init_ipython
install = ipython_00_10.install
+ is_installed = ipython_00_10.is_installed
+ __run = ipython_00_10.run
load_config = None
load_ipython_extension = None
unload_ipython_extension = None
-elif ipv >= [0, 11] and ipv < [0, 12]:
+elif ipv >= [0, 11] and ipv < [1, 0]:
from . import ipython_00_11
init_ipython = None
install = ipython_00_11.install
+ is_installed = ipython_00_11.is_installed
+ __run = ipython_00_11.run
load_config = ipython_00_11.load_config
load_ipython_extension = ipython_00_11.load_ipython_extension
unload_ipython_extension = ipython_00_11.unload_ipython_extension
-elif ipv >= [0, 12] and ipv < [1, 0]:
- from . import ipython_00_12
- init_ipython = None
- install = ipython_00_12.install
- load_config = ipython_00_12.load_config
- load_ipython_extension = ipython_00_12.load_ipython_extension
- unload_ipython_extension = ipython_00_12.unload_ipython_extension
+
+def run():
+ if not is_installed():
+ install(verbose=False)
+ __run()
diff --git a/PyTango/ipython/ipython_00_10/__init__.py b/PyTango/ipython/ipython_00_10/__init__.py
index 24eac01..06b5776 100644
--- a/PyTango/ipython/ipython_00_10/__init__.py
+++ b/PyTango/ipython/ipython_00_10/__init__.py
@@ -23,5 +23,5 @@
__all__ = ['init_ipython', 'install']
-from .ipython_00_10 import init_ipython
-from .ipy_install import install
\ No newline at end of file
+from .ipython_00_10 import init_ipython, run
+from .ipy_install import install, is_installed
diff --git a/PyTango/ipython/ipython_00_10/ipy_install.py b/PyTango/ipython/ipython_00_10/ipy_install.py
index 7359889..6e27c74 100644
--- a/PyTango/ipython/ipython_00_10/ipy_install.py
+++ b/PyTango/ipython/ipython_00_10/ipy_install.py
@@ -44,6 +44,12 @@ PyTango.ipython.init_ipython(ip)
"""
+def is_installed(ipydir=None):
+ install_dir = ipydir or IPython.genutils.get_ipython_dir()
+ f_name = os.path.join(install_dir, 'ipy_profile_tango.py')
+ return os.path.isfile(f_name)
+
+
def install(ipydir=None,verbose=True):
install_dir = ipydir or IPython.genutils.get_ipython_dir()
f_name = os.path.join(install_dir, 'ipy_profile_tango.py')
@@ -61,15 +67,15 @@ def install(ipydir=None,verbose=True):
return
profile = __PROFILE.format(pytangover=PyTango.Release.version, ipyver=IPython.Release.version)
- out.write("Installing tango extension to ipython... ")
+ out.write(u"Installing tango extension to ipython... ")
out.flush()
try:
f = open(f_name, "w")
f.write(profile)
f.close()
- out.write("[DONE]\n\n")
+ out.write(u"[DONE]\n\n")
except:
- out.write("[FAILED]\n\n")
+ out.write(u"[FAILED]\n\n")
raise
ipy_user_config = os.path.join(IPython.genutils.get_ipython_dir(), 'ipy_user_conf.py')
diff --git a/PyTango/ipython/ipython_00_10/ipython_00_10.py b/PyTango/ipython/ipython_00_10/ipython_00_10.py
index 450178a..d582b75 100644
--- a/PyTango/ipython/ipython_00_10/ipython_00_10.py
+++ b/PyTango/ipython/ipython_00_10/ipython_00_10.py
@@ -966,3 +966,18 @@ def init_ipython(ip, store=True, pytango=True, colors=True, console=True, magic=
if magic: init_magic(ip)
_tango_init = True
+
+def run():
+ argv = sys.argv
+
+ try:
+ for i, arg in enumerate(argv[:1]):
+ if arg.startswith('--profile='):
+ break
+ else:
+ argv.append("--profile=tango")
+ except:
+ pass
+
+ shell = IPython.Shell.start()
+ shell.mainloop()
diff --git a/PyTango/ipython/ipython_00_11/__init__.py b/PyTango/ipython/ipython_00_11/__init__.py
index 3a11264..443c485 100644
--- a/PyTango/ipython/ipython_00_11/__init__.py
+++ b/PyTango/ipython/ipython_00_11/__init__.py
@@ -22,8 +22,8 @@
################################################################################
__all__ = ['load_ipython_extension', 'unload_ipython_extension', 'load_config',
- 'install']
+ 'run', 'install', 'is_installed']
from .ipython_00_11 import load_ipython_extension, unload_ipython_extension, \
- load_config
-from .ipy_install import install
\ No newline at end of file
+ load_config, run
+from .ipy_install import install, is_installed
diff --git a/PyTango/ipython/ipython_00_11/ipy_install.py b/PyTango/ipython/ipython_00_11/ipy_install.py
index 3eb8906..8db8d73 100644
--- a/PyTango/ipython/ipython_00_11/ipy_install.py
+++ b/PyTango/ipython/ipython_00_11/ipy_install.py
@@ -51,6 +51,16 @@ PyTango.ipython.load_config(config)
# Put any additional environment here
"""
+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
+ config_file_name = BaseIPythonApplication.config_file_name.default_value
+ 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
@@ -73,7 +83,7 @@ def install(ipydir=None, verbose=True, profile='tango'):
if not create_config:
return
- out.write("Installing tango extension to ipython... ")
+ out.write(u"Installing tango extension to ipython... ")
out.flush()
profile = __PROFILE.format(pytangover=PyTango.Release.version,
@@ -81,8 +91,8 @@ def install(ipydir=None, verbose=True, profile='tango'):
with open(abs_config_file_name, "w") as f:
f.write(profile)
f.close()
- out.write("[DONE]\n\n")
- out.write("""\
+ out.write(u"[DONE]\n\n")
+ out.write(u"""\
To start ipython with tango interface simply type on the command line:
%% ipython --profile=tango
diff --git a/PyTango/ipython/ipython_00_11/ipython_00_11.py b/PyTango/ipython/ipython_00_11/ipython_00_11.py
index 1d1c063..fc1813e 100644
--- a/PyTango/ipython/ipython_00_11/ipython_00_11.py
+++ b/PyTango/ipython/ipython_00_11/ipython_00_11.py
@@ -41,6 +41,7 @@ from IPython.utils.ipstruct import Struct
from IPython.core.page import page
from IPython.core.interactiveshell import InteractiveShell
from IPython.config.application import Application
+from IPython.frontend.terminal.ipapp import launch_new_instance
import PyTango
import PyTango.utils
@@ -88,6 +89,9 @@ def get_config():
def get_editor():
return get_ipapi().editor
+def get_user_ns():
+ return get_shell().user_ns
+
class DeviceClassCompleter(object):
"""Completer class that returns the list of devices of some class when
called. """
@@ -240,10 +244,10 @@ __monitor_completer = __AttributeProxy_completer
# Magic commands
#-------------------------------------------------------------------------------
-def magic_refreshdb(self, parameter_s=''):
+def refreshdb(self, parameter_s=''):
init_db(parameter_s)
-def magic_switchdb(self, parameter_s=''):
+def switchdb(self, parameter_s=''):
"""Switches the active tango Database.
Usage: switchdb <host>[(:| )<port>]
@@ -260,7 +264,7 @@ def magic_switchdb(self, parameter_s=''):
"See '%switchdb?'")
return init_db(parameter_s)
-def magic_lsdev(self, parameter_s=''):
+def lsdev(self, parameter_s=''):
"""Lists all known tango devices.
Usage: lsdev [<device name filter(regular expression)]
@@ -294,7 +298,7 @@ def magic_lsdev(self, parameter_s=''):
s.seek(0)
page(s.read())
-def magic_lsdevclass(self, parameter_s=''):
+def lsdevclass(self, parameter_s=''):
"""Lists all known tango device classes.
Usage: lsdevclass [<class name filter(regular expression)]
@@ -319,7 +323,7 @@ def magic_lsdevclass(self, parameter_s=''):
s = textwrap.fill(" ".join(data), 80)
page(s)
-def magic_lsserv(self, parameter_s=''):
+def lsserv(self, parameter_s=''):
"""Lists all known tango servers.
Usage: lsserv [<class name filter(regular expression)]
@@ -344,21 +348,20 @@ def magic_lsserv(self, parameter_s=''):
s = textwrap.fill(" ".join(data), 80)
page(s)
-def magic_tango_error(self, parameter_s=''):
+def tango_error(self, parameter_s=''):
"""Displays detailed information about the last tango error"""
-
global _TANGO_ERR
- err_info = self.user_ns.get(_TANGO_ERR)
+ err_info = get_user_ns().get(_TANGO_ERR)
if err_info is None:
print("No tango error reported so far.")
return
print("Last tango error:")
print(err_info[1])
-def magic_python_error(self, parameter_s=''):
+def python_error(self, parameter_s=''):
"""Displays detailed information about the last python error"""
global _PYTHON_ERR
- err_info = self.user_ns.get(_PYTHON_ERR)
+ err_info = get_user_ns().get(_PYTHON_ERR)
if err_info is None:
print("No error reported so far.")
return
@@ -381,7 +384,7 @@ def __get_event_log():
_EVT_LOG = PyTango.ipython.eventlogger.EventLogger(capacity=10000, pager=page)
return _EVT_LOG
-def magic_mon(self, parameter_s=''):
+def mon(self, parameter_s=''):
"""Monitor a given attribute.
%mon -a <attribute name> - activates monitoring of given attribute
@@ -541,9 +544,10 @@ def get_alias_list():
def __exc_handler(ip, etype, value, tb, tb_offset=None):
global _TG_EXCEPTIONS
print(etype)
+ user_ns = get_user_ns()
if etype in _TG_EXCEPTIONS:
global _TANGO_ERR
- ip.user_ns[_TANGO_ERR] = etype, value, tb, tb_offset
+ user_ns[_TANGO_ERR] = etype, value, tb, tb_offset
if len(value.args):
v = value[0]
print("%s: %s" % (v.reason ,v.desc))
@@ -552,7 +556,7 @@ def __exc_handler(ip, etype, value, tb, tb_offset=None):
print("(For more detailed information type: tango_error)")
else:
global _PYTHON_ERR
- ip.user_ns[_PYTHON_ERR] = etype, value, tb, tb_offset
+ user_ns[_PYTHON_ERR] = etype, value, tb, tb_offset
print(etype.__name__ + ": " + str(value))
print("(For more detailed information type: python_error)")
@@ -576,8 +580,10 @@ def __get_db(host_port=None):
"""
ip = get_ipapi()
+ user_ns = get_user_ns()
+
global _DB_SYMB
- db = ip.user_ns.get(_DB_SYMB)
+ db = user_ns.get(_DB_SYMB)
if host_port is None:
if db is None:
@@ -604,22 +610,22 @@ def __get_db(host_port=None):
try:
db = PyTango.Database(*host_port.split(":"))
- ip.user_ns["DB_NAME"] = host_port
+ user_ns["DB_NAME"] = host_port
except Exception as e:
if db:
print("\nCould not access Database %s:" % host_port)
print(str(e))
old_host_port = "%s:%s" % (db.get_db_host(), db.get_db_port())
print("Maintaining connection to Database", old_host_port)
- ip.user_ns["DB_NAME"] = old_host_port
+ user_ns["DB_NAME"] = old_host_port
else:
print("\nCould not access any Database. Make sure:")
print("\t- .tangorc, /etc/tangorc or TANGO_HOST environment is defined.")
print("\t- the Database DS is running")
- ip.user_ns["DB_NAME"] = "OFFLINE"
+ user_ns["DB_NAME"] = "OFFLINE"
# register the 'db' in the user namespace
- ip.user_ns.update({ _DB_SYMB : db })
+ user_ns.update({ _DB_SYMB : db })
return db
@@ -660,7 +666,7 @@ def __expose_magic(ip, name, fn, completer_func=None):
ip.set_hook('complete_command', completer_func, re_key = ".*" + name)
def __unexpose_magic(ip, name):
- delattr(ip, 'magic_' + name)
+ delattr(ip, name)
def __build_color_scheme(ip, name):
import IPython.Prompts
@@ -728,15 +734,16 @@ def init_pytango(ip):
def init_db(parameter_s=''):
ip = get_ipapi()
+ user_ns = get_user_ns()
global _DB_SYMB
- old_db = ip.user_ns.get(_DB_SYMB)
+ old_db = user_ns.get(_DB_SYMB)
db = __get_db(parameter_s)
if old_db is not None and hasattr(old_db, "_db_cache"):
old_junk = old_db._db_cache["junk"].keys()
for e in old_junk:
- del ip.user_ns[e]
+ del user_ns[e]
else:
old_junk = ()
@@ -788,14 +795,14 @@ def init_db(parameter_s=''):
for klass, devices in klass_dict.items():
if klass in excluded_klasses:
continue
- exists = klass in ip.user_ns
+ exists = klass in user_ns
if not exists or klass in old_junk:
c = DeviceClassCompleter(klass, devices)
ip.set_hook('complete_command', c, re_key = ".*" + klass + "[^\w\.]+")
exposed_klasses[klass] = PyTango.DeviceProxy
# expose classes no user namespace
- ip.user_ns.update(exposed_klasses)
+ user_ns.update(exposed_klasses)
# Initialize attribute information
query = "SELECT name, alias FROM attribute_alias order by alias"
@@ -831,30 +838,42 @@ def init_db(parameter_s=''):
return db
def init_magic(ip):
- __expose_magic(ip, "refreshdb", magic_refreshdb)
- __expose_magic(ip, "reloaddb", magic_refreshdb)
- __expose_magic(ip, "switchdb", magic_switchdb)
- __expose_magic(ip, "lsdev", magic_lsdev)
- __expose_magic(ip, "lsdevclass", magic_lsdevclass)
- __expose_magic(ip, "lsserv", magic_lsserv)
- __expose_magic(ip, "tango_error", magic_tango_error)
- __expose_magic(ip, "python_error", magic_python_error)
- __expose_magic(ip, "mon", magic_mon, __monitor_completer)
- #__expose_magic(ip, "umon", magic_umon, __monitor_completer)
-
- ip.user_ns.update({"get_device_map" : get_device_map,
+
+ import IPython.core.magic
+
+ new_style_magics = hasattr(IPython.core.magic, 'Magics') and hasattr(IPython.core.magic, 'magics_class')
+
+ if new_style_magics:
+ @IPython.core.magic.magics_class
+ class Tango(IPython.core.magic.Magics):
+
+ refreshdb = IPython.core.magic.line_magic(refreshdb)
+ switchdb = IPython.core.magic.line_magic(switchdb)
+ lsdev = IPython.core.magic.line_magic(lsdev)
+ lsdevclass = IPython.core.magic.line_magic(lsdevclass)
+ lsserv = IPython.core.magic.line_magic(lsserv)
+ tango_error = IPython.core.magic.line_magic(tango_error)
+ python_error = IPython.core.magic.line_magic(python_error)
+ mon = IPython.core.magic.line_magic(mon)
+
+ ip.register_magics(Tango)
+ ip.set_hook('complete_command', __monitor_completer, re_key = ".*" + "mon")
+ else:
+ __expose_magic(ip, "refreshdb", refreshdb)
+ __expose_magic(ip, "switchdb", switchdb)
+ __expose_magic(ip, "lsdev", lsdev)
+ __expose_magic(ip, "lsdevclass", lsdevclass)
+ __expose_magic(ip, "lsserv", lsserv)
+ __expose_magic(ip, "tango_error", tango_error)
+ __expose_magic(ip, "python_error", python_error)
+ __expose_magic(ip, "mon", mon, __monitor_completer)
+
+ get_user_ns().update({"get_device_map" : get_device_map,
"get_server_map" : get_server_map,
"get_class_map" : get_class_map,
"get_alias_map" : get_alias_map,
"get_device_list" : get_device_list,
"get_alias_list" : get_alias_list})
-
- #__expose_magic(ip, "get_device_map", get_device_map)
- #__expose_magic(ip, "get_server_map", get_server_map)
- #__expose_magic(ip, "get_class_map", get_class_map)
- #__expose_magic(ip, "get_alias_map", get_alias_map)
- #__expose_magic(ip, "get_device_list", get_device_list)
- #__expose_magic(ip, "get_alias_list", get_alias_list)
def complete(text):
"""a super complete!!!!"""
@@ -1003,7 +1022,7 @@ class ITangoConsole(RichIPythonWidget):
def _banner_default(self):
config = get_config()
- return config.FrontendWidget.banner
+ return config.ITangoConsole.banner
import IPython.frontend.qt.console.qtconsoleapp
IPythonQtConsoleApp = IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp
@@ -1045,6 +1064,9 @@ def load_config(config):
so = config.get("tango_options", so)
+ import PyTango.ipython
+ ipy_ver = PyTango.ipython.get_ipython_version_list()
+
# ------------------------------------
# Application
# ------------------------------------
@@ -1056,8 +1078,19 @@ def load_config(config):
# ------------------------------------
i_shell = config.InteractiveShell
i_shell.colors = 'Linux'
- i_shell.prompt_in1 = 'ITango [\\#]: '
- i_shell.prompt_out = 'Result [\\#]: '
+
+ if ipy_ver >= [0, 12]:
+ # ------------------------------------
+ # PromptManager (ipython >= 0.12)
+ # ------------------------------------
+ prompt = config.PromptManager
+ prompt.in_template = 'ITango [\\#]: '
+ prompt.out_template = 'Result [\\#]: '
+ else:
+ # (Deprecated in ipython >= 0.12 use PromptManager.in_template)
+ i_shell.prompt_in1 = 'ITango [\\#]: '
+ # (Deprecated in ipython >= 0.12 use PromptManager.out_template)
+ i_shell.prompt_out = 'Result [\\#]: '
# ------------------------------------
# InteractiveShellApp
@@ -1102,14 +1135,16 @@ object? -> Details about 'object'. ?object also works, ?? prints more.
banner = banner.format(**d)
tango_banner = so.tango_banner % d
tango_banner = tango_banner.format(**d)
+ all_banner = "\n".join((banner, tango_banner))
+
term_i_shell.banner1 = banner
term_i_shell.banner2 = tango_banner
# ------------------------------------
# FrontendWidget
# ------------------------------------
- frontend_widget = config.FrontendWidget
- frontend_widget.banner = banner
+ frontend_widget = config.ITangoConsole
+ frontend_widget.banner = all_banner
def load_ipython_extension(ipython):
# The ``ipython`` argument is the currently active
@@ -1122,3 +1157,19 @@ def unload_ipython_extension(ipython):
# If you want your extension to be unloadable, put that logic here.
#print "Unloading PyTango IPython extension"
pass
+
+def run():
+
+ argv = sys.argv
+
+ try:
+ for i, arg in enumerate(argv[:1]):
+ if arg.startswith('--profile='):
+ break
+ else:
+ argv.append("--profile=tango")
+ except:
+ pass
+
+ launch_new_instance()
+
diff --git a/PyTango/ipython/ipython_00_12/ipython_00_12.py b/PyTango/ipython/ipython_00_12/ipython_00_12.py
deleted file mode 100644
index e274c40..0000000
--- a/PyTango/ipython/ipython_00_12/ipython_00_12.py
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python
-
-################################################################################
-##
-## This file is part of PyTango, a python binding for Tango
-##
-## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
-##
-## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
-##
-## PyTango is free software: you can redistribute it and/or modify
-## it under the terms of the GNU Lesser General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## PyTango is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public License
-## along with PyTango. If not, see <http://www.gnu.org/licenses/>.
-##
-################################################################################
-
-"""An IPython profile designed to provide a user friendly interface to Tango"""
-
-__all__ = ["load_config"]
-
-from IPython.utils.ipstruct import Struct
-from IPython.utils.coloransi import TermColors
-
-def load_config(config):
- import PyTango.ipython
-
- d = { "version" : PyTango.ipython.get_pytango_version(),
- "pyver" : PyTango.ipython.get_python_version(),
- "ipyver" : PyTango.ipython.get_ipython_version(),
- "pytangover" : PyTango.ipython.get_pytango_version(), }
- d.update(TermColors.__dict__)
-
- so = Struct(
- tango_banner="""%(Blue)shint: Try typing: mydev = Device("%(LightBlue)s<tab>%(Normal)s""")
-
- so = config.get("tango_options", so)
-
- # ------------------------------------
- # Application
- # ------------------------------------
- app = config.Application
- app.log_level = 30
-
- # ------------------------------------
- # InteractiveShell
- # ------------------------------------
- i_shell = config.InteractiveShell
- i_shell.colors = 'Linux'
-
- # ------------------------------------
- # PromptManager
- # ------------------------------------
- prompt = config.PromptManager
- prompt.in_template = 'ITango [\\#]: '
- #prompt.in2_template =
- prompt.out_template = 'Result [\\#]: '
-
- # ------------------------------------
- # InteractiveShellApp
- # ------------------------------------
- i_shell_app = config.InteractiveShellApp
- extensions = getattr(i_shell_app, 'extensions', [])
- extensions.append('PyTango.ipython')
- i_shell_app.extensions = extensions
- i_shell_app.ignore_old_config=True
-
- # ------------------------------------
- # TerminalIPythonApp: options for the IPython terminal (and not Qt Console)
- # ------------------------------------
- term_app = config.TerminalIPythonApp
- term_app.display_banner = True
- #term_app.nosep = False
- #term_app.classic = True
-
- # ------------------------------------
- # IPKernelApp: options for the Qt Console
- # ------------------------------------
- #kernel_app = config.IPKernelApp
- ipython_widget = config.IPythonWidget
- ipython_widget.in_prompt = 'ITango [<span class="in-prompt-number">%i</span>]: '
- ipython_widget.out_prompt = ' Out [<span class="out-prompt-number">%i</span>]: '
-
- #zmq_i_shell = config.ZMQInteractiveShell
-
- # ------------------------------------
- # TerminalInteractiveShell
- # ------------------------------------
- term_i_shell = config.TerminalInteractiveShell
- banner = """\
-%(Purple)sITango %(version)s%(Normal)s -- An interactive %(Purple)sTango%(Normal)s client.
-
-Running on top of Python %(pyver)s, IPython %(ipyver)s and PyTango %(pytangover)s
-
-help -> ITango's help system.
-object? -> Details about 'object'. ?object also works, ?? prints more.
-"""
-
- banner = banner % d
- banner = banner.format(**d)
- tango_banner = so.tango_banner % d
- tango_banner = tango_banner.format(**d)
- term_i_shell.banner1 = banner
- term_i_shell.banner2 = tango_banner
-
- # ------------------------------------
- # FrontendWidget
- # ------------------------------------
- frontend_widget = config.FrontendWidget
- frontend_widget.banner = banner
diff --git a/doc/itango/highlights.rst b/doc/itango/highlights.rst
index bb416c7..527a482 100644
--- a/doc/itango/highlights.rst
+++ b/doc/itango/highlights.rst
@@ -399,7 +399,6 @@ The way to do this is by editing your default ipython configuration file:
extensions = getattr(i_shell_app, 'extensions', [])
extensions.append('PyTango.ipython')
i_shell_app.extensions = extensions
- i_shell_app.ignore_old_config=True
for more information on how to configure IPython >= 0.11 please check the
`IPython configuration <http://ipython.org/ipython-doc/dev/config/ipython.html#configuring-the-ipython-command-line-application>`_
diff --git a/doc/itango/index.rst b/doc/itango/index.rst
index 7de75a1..53038bf 100644
--- a/doc/itango/index.rst
+++ b/doc/itango/index.rst
@@ -11,15 +11,13 @@ IPython profile.
ITango is available since PyTango 7.1.2
-You can start ITango by typing on the command line:
+You can start ITango by typing on the command line::
- #. For ipython <= 0.10::
-
- $ ipython -p tango
+ $ itango
- #. For ipython > 0.10::
+or the equivalent::
- $ ipython --profile=tango
+ $ ipython --profile=tango
and you should get something like this:
@@ -35,4 +33,4 @@ and you should get something like this:
--------------------------------------------------------------------------------
.. _IPython: http://ipython.org/
-.. _Tango: http://www.tango-controls.org/
\ No newline at end of file
+.. _Tango: http://www.tango-controls.org/
diff --git a/doc/man/itango.1 b/doc/man/itango.1
new file mode 100644
index 0000000..89bc375
--- /dev/null
+++ b/doc/man/itango.1
@@ -0,0 +1,50 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.4.
+.TH SARDANA "1" "January 2012" "Sardana 1.0.0" "User Commands"
+.SH NAME
+Sardana \- manual page for Sardana 1.0.0
+.SH SYNOPSIS
+.B usage:
+\fISardana instance_name \fR[\fIoptions\fR]
+.SH OPTIONS
+.TP
+\fB\-\-version\fR
+show program's version number and exit
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show this help message and exit
+.TP
+\fB\-\-log\-level\fR=\fILOG_LEVEL\fR
+log output level. Possible values are (case
+sensitive): critical (or 0), error (1), warning (2),
+info (3) debug (4), trace (5) [default: warning]
+.TP
+\fB\-\-log\-file\-level\fR=\fILOG_FILE_LEVEL\fR
+log file level. Possible values are (case sensitive):
+critical (or 0), error (1), warning (2), info (3)
+debug (4), trace (5) [default: debug]. Ignored if
+\fB\-\-without\-log\-file\fR is True
+.TP
+\fB\-\-log\-file\-name\fR=\fILOG_FILE_NAME\fR
+log file name. When given, MUST be absolute file name.
+[default: /tmp/tango/<DS name>/<DS instance name lower
+case>/log.txt]. Ignored if \fB\-\-without\-log\-file\fR is True
+.TP
+\fB\-\-without\-log\-file\fR=\fIWITHOUT_LOG_FILE\fR
+When set to True disables logging into a file
+[default: False]
+.TP
+\fB\-\-rconsole\-port\fR=\fIRCONSOLE_PORT\fR
+rconsole port number. [default: 0 meaning rconsole NOT
+active]
+.SH "SEE ALSO"
+The full documentation for
+.B Sardana
+is maintained as a Texinfo manual. If the
+.B info
+and
+.B Sardana
+programs are properly installed at your site, the command
+.IP
+.B info Sardana
+.PP
+should give you access to the complete manual.
diff --git a/doc/revision.rst b/doc/revision.rst
index ab57cc0..5120a93 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -82,6 +82,7 @@ Version history
| | Bug fixes: |
| | - from sourceforge: |
| | - `3023857: DevEncoded write attribute not supported <https://sourceforge.net/tracker/?func=detail&aid=3023857&group_id=57612&atid=484769>`_ |
+| | - `3521545: [pytango] problem with tango profile <https://sourceforge.net/tracker/?func=detail&aid=3521545&group_id=57612&atid=484769>`_ |
| | - `3530535: PyTango group writting fails <https://sourceforge.net/tracker/?func=detail&aid=3530535&group_id=57612&atid=484769>`_ |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 7.2.3 | Features: |
diff --git a/PyTango/ipython/ipython_00_12/__init__.py b/scripts/itango
old mode 100644
new mode 100755
similarity index 73%
rename from PyTango/ipython/ipython_00_12/__init__.py
rename to scripts/itango
index 0397776..1547a76
--- a/PyTango/ipython/ipython_00_12/__init__.py
+++ b/scripts/itango
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
################################################################################
##
## This file is part of PyTango, a python binding for Tango
@@ -21,11 +23,17 @@
##
################################################################################
-__all__ = ['load_ipython_extension', 'unload_ipython_extension', 'load_config',
- 'install']
-
-from PyTango.ipython.ipython_00_11 import *
+"""The itango startup file. This executable is actually an extension of the
+ ipython file that can be found in <prefix>/ipython (prefix usually being in
+ linux '/usr/bin'"""
-#rewrite 0.11's load config
-from .ipython_00_12 import load_config
+__all__ = [ "main" ]
+__docformat__ = 'restructuredtext'
+
+def main():
+ import PyTango.ipython
+ PyTango.ipython.run()
+
+if __name__ == '__main__':
+ main()
diff --git a/setup.cfg b/setup.cfg
index e3553ad..34f2bb8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,5 +3,5 @@ skip_build=True
[bdist_wininst]
skip_build=True
-title=PyTango 7
+title=PyTango 8
bitmap=doc\logo-medium.bmp
diff --git a/setup.py b/setup.py
index 09e0c84..8968bce 100644
--- a/setup.py
+++ b/setup.py
@@ -90,6 +90,30 @@ def has_numpy(with_src=True):
ret &= has_c_numpy()
return ret
+def get_script_files():
+ scripts_dir = abspath('scripts')
+ scripts = []
+ items = os.listdir(scripts_dir)
+ for item in items:
+ # avoid hidden files
+ if item.startswith("."):
+ continue
+ abs_item = os.path.join(scripts_dir, item)
+ # avoid non files
+ if not os.path.isfile(abs_item):
+ continue
+ # avoid files that have any extension
+ if len(os.path.splitext(abs_item)[1]) > 0:
+ continue
+ # avoid compiled version of script
+ if item.endswith('c') and item[:-1] in items:
+ continue
+ # avoid any core dump... of course there isn't any :-) but just in case
+ if item.startswith('core'):
+ continue
+ scripts.append('scripts/' + item)
+ return scripts
+
class build(dftbuild):
user_options = dftbuild.user_options + \
@@ -279,7 +303,9 @@ def main():
package_data = {
'PyTango' : [],
}
-
+
+ scripts = get_script_files()
+
data_files = []
classifiers = [
@@ -486,6 +512,7 @@ def main():
classifiers = classifiers,
package_data = package_data,
data_files = data_files,
+ scripts = scripts,
provides = provides,
keywords = Release.keywords,
requires = requires,
--
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