[pytango] 13/483: fixes #3284440

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:20 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 9cabc76a6c24d2ff7e7c2add81f9dfecf5da031a
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Wed Apr 13 12:39:51 2011 +0000

    fixes #3284440
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@16541 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 IPython/Extensions/ipy_profile_spock.py |  15 +++++
 doc/index.rst                           |  10 ++-
 doc/revision.rst                        |   6 +-
 setup.py                                | 112 +++++++-------------------------
 src/server/device_impl.cpp              |   2 +-
 5 files changed, 49 insertions(+), 96 deletions(-)

diff --git a/IPython/Extensions/ipy_profile_spock.py b/IPython/Extensions/ipy_profile_spock.py
new file mode 100644
index 0000000..857ced1
--- /dev/null
+++ b/IPython/Extensions/ipy_profile_spock.py
@@ -0,0 +1,15 @@
+""" IPython 'spock' profile, to preload PyTango and offer a friendly interface to Tango."""
+
+import IPython.ipapi
+import ipy_defaults
+
+def main():
+    ip = IPython.ipapi.get()
+    try:
+        ip.ex("import IPython.ipapi")
+        ip.ex("import PyTango.ipython")
+        ip.ex("PyTango.ipython.init_ipython(IPython.ipapi.get())")
+    except ImportError:
+        print "Unable to start spock profile, is PyTango installed?"
+
+main()
\ No newline at end of file
diff --git a/doc/index.rst b/doc/index.rst
index ab3f22a..8191011 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -13,15 +13,19 @@ Welcome to PyTango 7.1 documentation!
 
 .. sidebar:: Latest news
 
+    2011-04-13:
+        PyTango 7.1.5 is out!
+
+    2011-04-12:
+        PyTango 7.1.4 doesn't compile. Please don't use this release.
+        PyTango 7.1.5 will be released soon.
+
     2011-04-08:
         PyTango 7.1.4 is out!
 
     2010-11-05:
         PyTango 7.1.3 is out!
 
-    2010-08-19:
-        :ref:`Tango logging <logging>` updated
-
 PyTango is a python module that exposes to Python_ the complete Tango_ C++ API.
 This includes both client and server API.
 
diff --git a/doc/revision.rst b/doc/revision.rst
index 8d6ea81..3224314 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -55,7 +55,7 @@ History of modifications:
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
 | 08/04/11 | `8.8 <http://www.tango-controls.org/static/PyTango/v714/doc/html/index.html>`_   | Update to PyTango 7.1.4                             | T\. Coutinho          |
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
-| 12/04/11 | `8.9 <http://www.tango-controls.org/static/PyTango/v715/doc/html/index.html>`_   | Update to PyTango 7.1.5                             | T\. Coutinho          |
+| 13/04/11 | `8.9 <http://www.tango-controls.org/static/PyTango/v715/doc/html/index.html>`_   | Update to PyTango 7.1.5                             | T\. Coutinho          |
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
 
 .. _version-history:
@@ -66,14 +66,14 @@ Version history
 +------------+-------------------------------------------------------------------------------------+
 | version    | Changes                                                                             |
 +============+=====================================================================================+
-| 7.1.5      |                                                                                     |
-|            | Bug fixes:                                                                          |
+| 7.1.5      | Bug fixes:                                                                          |
 |            |     - from sourceforge:                                                             |
 |            |         - 3284174: 7.1.4 does not build with gcc 4.5 and tango 7.2.6                |
 |            |         - 3284265: [pytango][7.1.4] a few files without licence and copyright       |
 |            |         - 3284318: copyleft vs copyright                                            |
 |            |         - 3284434: [pytango][doc] few ERROR during the doc generation               |
 |            |         - 3284435: [pytango][doc] few warning during the doc generation             |
+|            |         - 3284440: [pytango][spock] the profile can't be installed                  |
 +------------+-------------------------------------------------------------------------------------+
 | 7.1.4      | Features:                                                                           |
 |            |     - from sourceforge:                                                             |
diff --git a/setup.py b/setup.py
index 47538c1..c11f573 100644
--- a/setup.py
+++ b/setup.py
@@ -105,9 +105,10 @@ please_debug = False
 packages = [
     'PyTango',
     'PyTango.ipython',
-    'PyTango3'
 ]
 
+py_modules = []
+
 provides = [
     'PyTango',
 ]
@@ -309,32 +310,29 @@ from distutils.command.install import install as dftinstall
 from distutils.unixccompiler import UnixCCompiler
 
 class build(dftbuild):
-
+    
     user_options = dftbuild.user_options + \
-        [('ipython-local', None, "install spock as current user profile instead of as an ipython extension"),
-        ('ipython-dir=', None, "Location of the ipython installation. (Defaults to '%s' if ipython-local is NOT set or to '%s' otherwise" % (_IPY_ROOT, _IPY_LOCAL) ) ]
-
-    boolean_options = [ 'ipython-local' ]
-
+        [('with-pytango3', None, "distribute PyTango3 module"),
+         ('without-spock', None, "spock IPython extension")]
+    
+    boolean_options = dftbuild.boolean_options + ['with-pytango3', 'without-spock']
+    
     def initialize_options (self):
         dftbuild.initialize_options(self)
-        self.ipython_dir = None
-        self.ipython_local = False
+        self.with_pytango3 = None
+        self.without_spock = None
     
     def finalize_options(self):
         dftbuild.finalize_options(self)
-        if self.ipython_dir is None:
-            if self.ipython_local:
-                global _IPY_LOCAL
-                self.ipython_dir = _IPY_LOCAL
-            else:
-                global _IPY_ROOT
-                self.ipython_dir = os.path.join(_IPY_ROOT, "Extensions")
-        else:
-            if ipython-local:
-                self.warn("Both options 'ipython-dir' and 'ipython-local' were given. " \
-                          "'ipython-dir' will be used.")
-        self.ensure_dirname('ipython_dir')
+        
+    def run(self):
+        if self.with_pytango3:
+            self.distribution.packages.append('PyTango3')
+        
+        if IPython and not self.without_spock:
+            self.distribution.py_modules.append('IPython.Extensions.ipy_profile_spock')
+
+        dftbuild.run(self)
 
     def has_doc(self):
         if sphinx is None: return False
@@ -373,45 +371,6 @@ if sphinx:
     
     cmdclass['build_doc'] = build_doc
 
-if IPython:
-    class install_spock(Command):
-        
-        description = "Install Spock, the PyTango's IPython extension"
-
-        user_options = [
-            ('ipython-local', None, "install spock as current user profile instead of as an ipython extension"),
-            ('ipython-dir=', None, "Location of the ipython installation. (Defaults to '%s' if ipython-local is NOT set or to '%s' otherwise" % (_IPY_ROOT, _IPY_LOCAL) ) ]
-
-        boolean_options = [ 'ipython-local' ]
-
-        def initialize_options (self):
-            self.ipython_dir = None
-            self.ipython_local = False
-        
-        def finalize_options(self):
-            self.set_undefined_options('install',
-                                       ('ipython_local', 'ipython_local'),
-                                       ('ipython_dir', 'ipython_dir'))
-        
-        def run(self):
-            added_path = False
-            try:
-                import PyTango.ipython
-                PyTango.ipython.install(self.ipython_dir, verbose=False)
-            except IOError, ioerr:
-                self.warn("Unable to install Spock IPython extension. Reason:")
-                self.warn(str(ioerr))
-                if ioerr.errno == errno.EACCES:
-                    self.warn("Probably you don't have enough previledges to install spock as an ipython extension.")
-                    self.warn("Try executing setup.py with sudo or otherwise give '--ipython-local' parameter to")
-                    self.warn("setup.py to install spock as a current user ipython profile.")
-                    self.warn("type: setup.py --help install_spock for more information")
-            except Exception, e:
-                self.warn("Unable to install Spock IPython extension. Reason:")
-                self.warn(str(e))
-            
-    cmdclass['install_spock'] = install_spock
-
 
 class install_html(Command):
 
@@ -434,36 +393,15 @@ cmdclass['install_html'] = install_html
 
 class install(dftinstall):
     
-    user_options = list(dftinstall.user_options)
-    user_options.extend([
-        ('ipython-local', None, "install spock as current user profile instead of as an ipython extension"),
-        ('ipython-dir=', None, "Location of the ipython installation. (Defaults to '%s' if ipython-local is NOT set or to '%s' otherwise" % (_IPY_ROOT, _IPY_LOCAL) ),
-        ('install-html=', None, "installation directory for HTML documentation") ])
-
-    boolean_options = list(dftinstall.boolean_options)
-    boolean_options.append('ipython-local')
+    user_options = dftinstall.user_options + \
+        [('install-html=', None, "installation directory for HTML documentation"),]
 
     def initialize_options(self):
         dftinstall.initialize_options(self)
-        self.ipython_dir = None
-        self.ipython_local = False
         self.install_html = None
-    
+
     def finalize_options(self):
         dftinstall.finalize_options(self)
-        if self.ipython_dir is None:
-            if self.ipython_local:
-                global _IPY_LOCAL
-                self.ipython_dir = _IPY_LOCAL
-            else:
-                global _IPY_ROOT
-                self.ipython_dir = os.path.join(_IPY_ROOT, "Extensions")
-        else:
-            if self.ipython_local:
-                self.warn("Both options 'ipython-dir' and 'ipython-local' were given. " \
-                          "'ipython-dir' will be used.")
-        self.ensure_dirname('ipython_dir')
-
         # We do a hack here. We cannot trust the 'install_base' value because it
         # is not always the final target. For example, in unix, the install_base
         # is '/usr' and all other install_* are directly relative to it. However,
@@ -475,16 +413,11 @@ class install(dftinstall):
         # different systems.
         if self.install_html is None:
             self.install_html = os.path.join(self.install_data, 'share', 'doc', 'PyTango', 'html')
-        self.dump_dirs("Installation directories")
         
-    def has_ipython(self):
-        return IPython is not None
-
     def has_html(self):
         return sphinx is not None
     
     sub_commands = list(dftinstall.sub_commands)
-    sub_commands.append(('install_spock', has_ipython))
     sub_commands.append(('install_html', has_html))
 
 
@@ -503,6 +436,7 @@ dist = setup(
     license          = Release.license,
     packages         = packages,
     package_dir      = { 'PyTango' : 'PyTango', 'PyTango3' : 'PyTango3' },
+    py_modules       = py_modules,
     classifiers      = classifiers,
     package_data     = package_data,
     data_files       = data_files,
diff --git a/src/server/device_impl.cpp b/src/server/device_impl.cpp
index 3fb2d3e..699637c 100644
--- a/src/server/device_impl.cpp
+++ b/src/server/device_impl.cpp
@@ -708,7 +708,7 @@ void Device_3ImplWrap::_init()
 
     // Tell Tango that this is a Python device.
     // Humm, we should try to avoid this in the future
-    //this->set_py_device(true);
+    this->set_py_device(true);
 
     Tango::Device_3ImplExt *tmp_ptr = ext_3;
     Py_Device_3ImplExt *new_ext = new Py_Device_3ImplExt(this);

-- 
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