Author: bugman
Date: Thu Oct 27 12:48:18 2016
New Revision: 28262

URL: http://svn.gna.org/viewcvs/relax?rev=28262&view=rev
Log:
Added support in the information printout for Windows versions of the 'file' 
program.

This enables the C modules to be identified as 32 or 64-bit, if the 'file' 
program is installed.


Modified:
    trunk/info.py

Modified: trunk/info.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/info.py?rev=28262&r1=28261&r2=28262&view=diff
==============================================================================
--- trunk/info.py       (original)
+++ trunk/info.py       Thu Oct 27 12:48:18 2016
@@ -176,8 +176,10 @@
         if Popen == None:
             return ''
 
-        # MS Windows (has no 'file' command or libmagic, so return nothing).
-        if hasattr(ctypes, 'windll'):
+        # Test if the 'file' program is installed.
+        pipe = Popen('file --help', shell=True, stdout=PIPE, stderr=PIPE, 
close_fds=False)
+        err = pipe.stderr.readlines()
+        if err:
             return ''
 
         # The command.
@@ -185,7 +187,8 @@
 
         # Execute.
         pipe = Popen(cmd, shell=True, stdout=PIPE, close_fds=False)
-        waitpid(pipe.pid, 0)
+        if not hasattr(ctypes, 'windll'):
+            waitpid(pipe.pid, 0)
 
         # The STDOUT data.
         data = pipe.stdout.readlines()
@@ -240,7 +243,9 @@
                 arch[i] = row[1][:-1]
                 file_type += " %s" % arch
 
-        # Return the string.
+        # Return a string value.
+        if file_type == None:
+            return ''
         return file_type
 
 


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to