[pytango] 163/483: try to detect tango dll location on windows

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:36 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 affe68d2a3473c86045c343da79c3c74c0f35bac
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Wed Oct 10 08:51:34 2012 +0000

    try to detect tango dll location on windows
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@21252 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 PyTango/__init__.py | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/PyTango/__init__.py b/PyTango/__init__.py
index 4a0d750..4dfcee8 100644
--- a/PyTango/__init__.py
+++ b/PyTango/__init__.py
@@ -86,21 +86,39 @@ __all__ = [ 'AccessControlType', 'ApiUtil', 'ArchiveEventInfo',
 
 __docformat__ = "restructuredtext"
 
+import os
 import sys
 
+def __prepare_nt():
+    PATH = os.environ['PATH']
+    tango_root = os.environ.get("TANGO_ROOT")
+    if tango_root is None:
+        tango_root = os.path.join(os.environ["ProgramFiles"], "tango")
+    if sys.hexversion < 0x03030000:
+        vc = "vc9_dll"
+    else:
+        vc = "vc10_dll"
+    tango_dll_path = os.path.join(tango_root,"win32","lib",vc)
+    if tango_dll_path.lower() not in PATH.lower():
+        os.environ['PATH'] += ";" + tango_dll_path
+
 try:
     from ._PyTango import DeviceProxy
 except ImportError as ie:
-    if not ie.args[0].count("_PyTango"):
-        raise ie
-    print(80*"-")
-    print(ie)
-    print(80*"-")
-    print("Probably your current directory is the PyTango's source installation directory.")
-    print("You must leave this directory first before using PyTango, otherwise the")
-    print("source distribution will conflict with the installed PyTango")
-    print(80*"-")
-    sys.exit(1)
+    if ie.args[0].count("_PyTango"):
+        print(80*"-")
+        print(ie)
+        print(80*"-")
+        print("Probably your current directory is the PyTango's source installation directory.")
+        print("You must leave this directory first before using PyTango, otherwise the")
+        print("source distribution will conflict with the installed PyTango")
+        print(80*"-")
+        raise
+    
+    # in windows try to find the location for tango
+    if os.name == 'nt':
+        __prepare_nt()
+        from ._PyTango import DeviceProxy
 
 from ._PyTango import (AccessControlType, ApiUtil, ArchiveEventInfo,
     AsynCall, AsynReplyNotArrived, AttReqType, Attr, AttrConfEventData,

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