[pytango] 378/483: Fix bug with unicode

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:15:02 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 c330a682e680f56a74ac122c241621e49bafc1b7
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Wed May 7 07:05:57 2014 +0000

    Fix bug with unicode
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@25538 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 src/boost/python/ipython/ipython_00_10/ipy_install.py | 19 ++++++++++---------
 src/boost/python/ipython/ipython_00_11/ipy_install.py | 15 ++++++++-------
 src/boost/python/ipython/ipython_10_00/ipy_install.py | 17 +++++++++--------
 3 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/boost/python/ipython/ipython_00_10/ipy_install.py b/src/boost/python/ipython/ipython_00_10/ipy_install.py
index 8fb2144..a8bc514 100644
--- a/src/boost/python/ipython/ipython_00_10/ipy_install.py
+++ b/src/boost/python/ipython/ipython_00_10/ipy_install.py
@@ -13,7 +13,6 @@
 
 import sys
 import os
-import io
 
 import IPython.genutils
 import PyTango
@@ -38,13 +37,16 @@ def is_installed(ipydir=None):
     return os.path.isfile(f_name)
     
 
-def install(ipydir=None,verbose=True):
+def install(ipydir=None, verbose=True, profile='tango'):
     install_dir = ipydir or IPython.genutils.get_ipython_dir()
     f_name = os.path.join(install_dir, 'ipy_profile_tango.py')
     if verbose:
-        out = sys.stdout
+        def out(msg):
+            sys.stdout.write(msg)
+            sys.stdout.flush()
     else:
-        out = io.BytesIO()
+        out = lambda x : None
+            
     if ipydir is None and os.path.isfile(f_name):
         print("Warning: The file '%s' already exists." % f_name)
         r = ''
@@ -55,19 +57,18 @@ 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.flush()
+    out("Installing tango extension to ipython... ")
     try:
         f = open(f_name, "w")
         f.write(profile)
         f.close()
-        out.write("[DONE]\n\n")
+        out("[DONE]\n\n")
     except:
-        out.write("[FAILED]\n\n")
+        out("[FAILED]\n\n")
         raise
     
     ipy_user_config = os.path.join(IPython.genutils.get_ipython_dir(), 'ipy_user_conf.py')
-    out.write("""\
+    out("""\
 To start ipython with tango interface simply type on the command line:
 %% ipython -p tango
 
diff --git a/src/boost/python/ipython/ipython_00_11/ipy_install.py b/src/boost/python/ipython/ipython_00_11/ipy_install.py
index f86a466..cbf09a0 100644
--- a/src/boost/python/ipython/ipython_00_11/ipy_install.py
+++ b/src/boost/python/ipython/ipython_00_11/ipy_install.py
@@ -53,10 +53,12 @@ def is_installed(ipydir=None, profile='tango'):
 
 def install(ipydir=None, verbose=True, profile='tango'):
     if verbose:
-        out = sys.stdout
+        def out(msg):
+            sys.stdout.write(msg)
+            sys.stdout.flush()
     else:
-        out = io.StringIO()
-    
+        out = lambda x : None
+            
     ipython_dir = ipydir or get_ipython_dir()
     try:
         p_dir = ProfileDir.find_profile_dir_by_name(ipython_dir, profile)
@@ -71,16 +73,15 @@ def install(ipydir=None, verbose=True, profile='tango'):
     if not create_config:
         return
 
-    out.write("Installing tango extension to ipython... ")
-    out.flush()
+    out("Installing tango extension to ipython... ")
 
     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("""\
+    out("[DONE]\n\n")
+    out("""\
 To start ipython with tango interface simply type on the command line:
 %% ipython --profile=tango
 
diff --git a/src/boost/python/ipython/ipython_10_00/ipy_install.py b/src/boost/python/ipython/ipython_10_00/ipy_install.py
index f86a466..b0f7bc4 100644
--- a/src/boost/python/ipython/ipython_10_00/ipy_install.py
+++ b/src/boost/python/ipython/ipython_10_00/ipy_install.py
@@ -13,9 +13,8 @@
 
 from __future__ import with_statement
 
-import sys
 import os
-import io
+import sys
 
 import IPython
 from IPython.core.profiledir import ProfileDirError, ProfileDir
@@ -51,11 +50,14 @@ def is_installed(ipydir=None, profile='tango'):
     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
+        def out(msg):
+            sys.stdout.write(msg)
+            sys.stdout.flush()
     else:
-        out = io.StringIO()
+        out = lambda x : None
     
     ipython_dir = ipydir or get_ipython_dir()
     try:
@@ -71,16 +73,15 @@ def install(ipydir=None, verbose=True, profile='tango'):
     if not create_config:
         return
 
-    out.write("Installing tango extension to ipython... ")
-    out.flush()
+    out("Installing tango extension to ipython... ")
 
     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("""\
+    out("[DONE]\n\n")
+    out("""\
 To start ipython with tango interface simply type on the command line:
 %% ipython --profile=tango
 

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