installing netcdfmodule

hinsen@cnrs-orleans.fr hinsen@cnrs-orleans.fr
Thu, 4 Jun 1998 12:21:14 -0500 (CDT)


> installed libnetcdf.a in /usr/local/lib. The README file for
> netcdfmodule 
> states:
> 
> 1) For Python versions before 1.5:
>    Copy the file Misc/Makefile.pre.in from the Python distribution to
>    this directory.
> 2) Type
>       python compile.py
> 3) Type
>       python install.py
> 
> I have no idea what to do at this point. There is no compile.py or
> install.py 
> on my system. Thanks for any help.

Both compile.py and install.py should come with the netCDF module.
I just checked and found that they are missing in the current distribution.
I'll update the distribution as soon as possible, but since the files
are short, I'll include them here:

== compile.py =============================================================
# Compile the netCDF extension

import os, sys

lib = os.path.join(os.path.join(sys.exec_prefix, 'lib'),
                   'python'+sys.version[:3])

if not os.path.exists('Makefile.pre.in'):
    source = os.path.join(os.path.join(lib, 'config'), 'Makefile.pre.in')
    if os.path.exists(source):
        os.system('cp ' + source + ' .')
    else:
        print "Copy Misc/Makefile.pre.in from the Python distribution"
        print "to this directory and try again."

os.system("make -f Makefile.pre.in boot")
os.system("make")
===========================================================================

== install.py =============================================================
# Install the netCDF extension

import os, string, sys

lib = os.path.join(os.path.join(sys.exec_prefix, 'lib'),
                   'python'+sys.version[:3])
include = os.path.join(os.path.join(sys.exec_prefix, 'include'),
                       'python'+sys.version[:3])

os.system("grep '^SO' Makefile > temp")
line = open("temp").readlines()[0]
os.unlink("temp")
extension = string.strip(line[string.find(line, '=')+1:])

if os.path.exists(os.path.join(lib, 'lib-dynload')):
    os.system("cp netcdf*" + extension + ' ' +
              os.path.join(lib, 'lib-dynload'))
else:
    os.system("cp netcdf*" + extension + ' ' +
              os.path.join(lib, 'sharedmodules'))
os.system("cp netcdfmodule.h " + include)
===========================================================================

Alternatively, you can follow the instructions given by Lutz, which
is the old installation procedure. And even if you use the scripts,
read his advice on modifying the Setup file. Unfortunately there is
not yet an easy way to do this automatically.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------