mailr2563 - /1.2/sconstruct


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 15, 2006 - 06:53:
Author: bugman
Date: Fri Sep 15 06:53:20 2006
New Revision: 2563

URL: http://svn.gna.org/viewcvs/relax?rev=2563&view=rev
Log:
A number of modifications to the sconstruct script for MS Windows 
compatibility.

The contents of the function self.setup_c() has been temporarily shifted into 
the self.relax_fit()
function.  Once other parts of relax have been ported to C, then most of 
self.relax_fit() can be
shifted into a new generic C building function.

The file extensions 'obj', 'dll', 'exp', and 'lib' have been added to the 
list to remove when 'scons
clean' is typed.  These are the compilation files generated by Microsoft 
Visual Studio (MSVS),
specifically Microsoft Visual C++ (MSVC) which compiles C code.

The C compilation flags have been made system dependent.  For example the 
include flag in Windows is
'/I' whereas in Unix like systems it is '-I'.

The Python include path has been split into two, 'py_include_minpath' and 
'py_include_fullpath'.

In Windows the Python library path (where python24.lib is located) cannot be 
found so the LIBPATH
variable pointing to the file has been added to the build environment.

In a number of places the Unix path separator '/' has been replaced by the 
system independent Python
object 'path.sep'.


Modified:
    1.2/sconstruct

Modified: 1.2/sconstruct
URL: 
http://svn.gna.org/viewcvs/relax/1.2/sconstruct?rev=2563&r1=2562&r2=2563&view=diff
==============================================================================
--- 1.2/sconstruct (original)
+++ 1.2/sconstruct Fri Sep 15 06:53:20 2006
@@ -54,9 +54,6 @@
         # Set the help message.
         self.help()
 
-        # Set up the C options.
-        self.setup_c()
-
         # The operating system.
         self.system = platform.uname()[0]
 
@@ -175,7 +172,7 @@
         print "###############################\n\n"
 
         # Extensions of temporary files.
-        temp_extns = ['pyc', 'bak', 'o', 'os']
+        temp_extns = ['pyc', 'bak', 'o', 'os', 'obj', 'dll', 'exp', 'lib']
 
         # Print out.
         print "\nRemoving the files ending in " + `temp_extns` + ".\n"
@@ -338,20 +335,38 @@
                  'exponential.c',
                  'relax_fit.c']
 
+        # Construct the python include path (for Python.h).
+        py_include_minpath = sys.prefix + path.sep + 'include'
+        py_include_fullpath = py_include_minpath + path.sep + 'python' + 
`sys.version_info[0]` + '.' + `sys.version_info[1]`
+
+        # C flags.
+        if self.system == 'Windows':
+            cflags = '/nologo /I\"' + py_include_minpath + '\"'
+        else:
+            cflags = '-I' + py_include_fullpath
+
         # Relaxation curve fitting build environment.
         env = Environment()
 
+        # Python library path.
+        libpath = ''
+        if self.system == 'Windows':
+            libpath = sys.prefix + path.sep + 'libs'
+
+        # Add the python library path to the environment.
+        env.Append(LIBPATH = libpath)
+
         # Catch Mac OS X and send the correct command line options to the 
linker.
         if env['PLATFORM'] == 'darwin':
-            env.Append(LINKFLAGS = ['-bundle', '-bundle_loader', sys.prefix 
+ '/bin/python', '-dynamic'])
+            env.Append(LINKFLAGS = ['-bundle', '-bundle_loader', sys.prefix 
+ path.sep + 'bin' + path.sep + 'python', '-dynamic'])
 
         # Loop over the relaxation curve fitting files.
         nodes = []
         for file in files:
-            nodes.append(env.SharedObject(dir + '/' + file, 
CCFLAGS=self.cflags))
+            nodes.append(env.SharedObject(dir + path.sep + file, 
CCFLAGS=cflags))
 
         # Build the relaxation curve fitting module.
-        self.relax_fit_object = env.SharedLibrary(target=dir + '/relax_fit', 
source=nodes, SHLIBPREFIX='')
+        self.relax_fit_object = env.SharedLibrary(target=dir + path.sep + 
'relax_fit', source=nodes, SHLIBPREFIX='')
 
         # Print out string returning function.
         def print_string(target=None, source=None, env=None):
@@ -417,16 +432,6 @@
         self.TAR_SRC_FILE = 'relax-' + version + '.src.tar.bz2'
 
 
-    def setup_c(self):
-        """Function for setting up the C options."""
-
-        # Construct the python include path (for Python.h).
-        py_include_path = sys.prefix + '/include/python' + 
`sys.version_info[0]` + '.' + `sys.version_info[1]`
-
-        # C flags.
-        self.cflags = '-I' + py_include_path
-
-
     def tar(self, target=None, source=None, env=None):
         """Builder action for creating the tar archive."""
 
@@ -469,10 +474,10 @@
                 # Create the file name (without the base directory).
                 name = path.join(root, files[i])
                 name = name[len(base):]
-                print 'relax-' + version + '/' + name
+                print 'relax-' + version + path.sep + name
 
                 # Tar information.
-                tarinfo = archive.gettarinfo(name, 'relax-' + version + '/' 
+ name)
+                tarinfo = archive.gettarinfo(name, 'relax-' + version + 
path.sep + name)
 
                 # Add the file.
                 archive.addfile(tarinfo, file)




Related Messages


Powered by MHonArc, Updated Fri Sep 15 07:00:09 2006