[pytango] 171/483: added script to allow PyTango to install tango dll files when needed

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:37 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 9ac4f5756218870dfd6becf49060d35b6c2ad875
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Mon Oct 22 15:33:16 2012 +0000

    added script to allow PyTango to install tango dll files when needed
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@21370 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 scripts/winpostinstall.py | 81 +++++++++++++++++++++++++++++++++++++++++++++++
 setup.py                  |  4 ---
 winsetup.py               | 33 ++-----------------
 3 files changed, 84 insertions(+), 34 deletions(-)

diff --git a/scripts/winpostinstall.py b/scripts/winpostinstall.py
new file mode 100644
index 0000000..2089f5e
--- /dev/null
+++ b/scripts/winpostinstall.py
@@ -0,0 +1,81 @@
+from __future__ import print_function
+
+import sys
+import os
+import os.path
+
+import urllib
+try:
+    urlretrieve = urllib.urlretrieve
+except AttributeError:
+    import urllib.request
+    urlretrieve = urllib.urlrequest.urlretrieve
+
+try:
+    file_created
+except:
+    def file_created(*args, **kwargs): pass
+
+def find_tango_root():
+    program_files = os.environ["PROGRAMFILES"]
+    tango = os.path.join(program_files, 'tango')
+    if os.path.isdir(tango):
+        return tango
+
+def find_tango_dll():
+    program_files = os.environ["PROGRAMFILES"]
+    tangodll = os.path.join(program_files, 'tango','win32','lib','vc9_dll')
+    if os.path.isdir(tangodll):
+        return tangodll
+
+def install_tango_dll():
+    pytango_web = "http://www.tango-controls.org/static/PyTango/"
+    print("Fetching appropriate tango from " + pytango_web+ "...")
+    pytango_dll_path = pytango_web + "tangodll/"
+    pytango_dll_file = pytango_dll_path + "tango_8.0_win32_vc9_dll.zip"
+    filename, headers = urlretrieve(pytango_dll_file)
+    import distutils.sysconfig
+    import zipfile
+    pytango_dll_zip = zipfile.ZipFile(filename)
+    pytango_dir = distutils.sysconfig.get_python_lib()
+    pytango_dir = os.path.join(pytango_dir, "PyTango")
+    print("Extracting " + filename + " into " + pytango_dir + "...")
+    pytango_dll_zip.extractall(pytango_dir)
+    print("Registering all files...")
+    for name in pytango_dll_zip.namelist():
+        print("Registering " + name)
+        name = os.path.join(pytango_dir, name)
+        file_created(name)
+    
+def remove():
+    print ("removing PyTango")
+    
+def install():
+    tango = find_tango_dll()
+    if tango is None:
+        print("Could NOT find Tango C++!")
+        install_tango_dll()
+    else:
+        print("Found tango at " + tango)
+        return
+
+def main():
+    if len(sys.argv) < 2:
+        op = "-install"
+    else:
+        op = sys.argv[1]
+    
+    if "-install" in op:
+        install()
+    elif "-remove" in op:
+        remove()
+    else:
+        print("unknown operation " + op)
+ 
+if __name__ == "__main__":
+    try:
+        main()
+    except:
+        import traceback
+        traceback.print_exc()
+        raw_input("Press any key to continue")
\ No newline at end of file
diff --git a/setup.py b/setup.py
index cde2899..2b14f45 100644
--- a/setup.py
+++ b/setup.py
@@ -114,10 +114,6 @@ def get_script_files():
         # 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
diff --git a/winsetup.py b/winsetup.py
index 9b8e3a1..7e1cf47 100644
--- a/winsetup.py
+++ b/winsetup.py
@@ -63,11 +63,12 @@ try:
 #                % (build_dir,)
     cmd_line += 'bdist_msi --skip-build --target-version=%s ' \
                 '--dist-dir=%s ' \
-                % (ver, dist_dir)
+                '--install-script=winpostinstall.py ' % (ver, dist_dir)
     cmd_line += 'bdist_wininst --skip-build --target-version=%s ' \
                 '--dist-dir=%s ' \
                 '--title="PyTango 8" ' \
-                '--bitmap="%s" ' % (ver, dist_dir, bitmap)
+                '--bitmap="%s" ' \
+                '--install-script=winpostinstall.py ' % (ver, dist_dir, bitmap)
     os.system(cmd_line)
 except:
     print("Failed:")
@@ -79,31 +80,3 @@ finally:
 
 sys.exit(0)
 
-try:
-    cmd_line = '%s %s build_py --force --no-compile ' \
-               '--build-lib=%s' \
-                % (executable, setup_name, build_dir)
-    os.system(cmd_line)
-
-    cmd_line = '%s %s build_scripts --force' % (executable, setup_name)
-    os.system(cmd_line)
-
-    cmd_line = '%s %s bdist_msi --skip-build --target-version=%s ' \
-               '--dist-dir=%s' \
-               % (executable, setup_name, ver, dist_dir)
-    os.system(cmd_line)
-
-    cmd_line = '%s %s bdist_wininst --skip-build --target-version=%s ' \
-               '--dist-dir=%s ' \
-               '--title="PyTango 8" ' \
-               '--bitmap="%s"' % (executable, setup_name, ver, dist_dir, bitmap)
-    os.system(cmd_line)
-except:
-    print("Failed:")
-    import traceback
-    traceback.print_exc()
-    sys.exit(1)
-finally:
-    os.chdir(curr_dir)
-
-sys.exit(0)
\ No newline at end of file

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