[SciPy-dev] numpy.distuils question
Uwe Schmitt
uschmitt@mineway...
Fri Sep 5 12:08:07 CDT 2008
Thanks, I will try it.
Greetings, Uwe
Am 05.09.2008 um 19:02 schrieb Charles Doutriaux:
> Uwe,
>
> I'm attaching an example of setup.py i have that does what you want.
>
> I have the strucutre:
> setup.py
> Lib/
> __init__.py
> ...python files ....
> Src/
> ..fortran or C files ...
>
> Hope this helps.
> C.
>
> Note that I also have a .pyf file just to make the i/o to f2py a bit
> cleaner but it is not necessary
>
> C.
>
> Uwe Schmitt wrote:
>> Hi,
>>
>> Thanks to the document team I managed to write a setup.py file which
>> builds an extension module with f2py.
>> My problem is to install further Python files.
>>
>> My directory looks like this:
>>
>> setup.py
>> module.pyf
>> module.f
>> my_new_package/
>> __init__.py
>> modulewrapper.py
>>
>>
>> the modulewrapper loads module.pyd.
>>
>> setup.py looks like this:
>>
>> def configuration(parent_package='',top_path=None):
>> from numpy.distutils.misc_util import Configuration
>> config =
>> Configuration('my_new_package',parent_package,top_path)
>>
>> config.add_extension('module',
>> sources = ['module.pyf', 'module.f']
>> )
>>
>> return config
>>
>> if __name__ == "__main__":
>> from numpy.distutils.core import setup
>> setup(**configuration(top_path='').todict())
>>
>>
>>
>> How do I have to change/extend setup.py ?
>>
>> Greetings, Uwe
>> --
>> Dr. rer. nat. Uwe Schmitt
>> F&E Mathematik
>> mineway GmbH
>> Science Park 2
>> D-66123 Saarbrücken
>> Telefon: +49 (0)681 8390 5334
>> Telefax: +49 (0)681 830 4376
>> uschmitt@mineway.de
>> www.mineway.de
>> Geschäftsführung: Dr.-Ing. Mathias Bauer
>> Amtsgericht Saarbrücken HRB 12339
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Scipy-dev mailing list
>> Scipy-dev@scipy.org
>> http:// projects.scipy.org/mailman/listinfo/scipy-dev
>>
> import sys,os
> target_prefix = sys.prefix
> for i in range(len(sys.argv)):
> a = sys.argv[i]
> if a=='--prefix':
> target_prefix=sys.argv[i+1]
> sp = a.split("--prefix=")
> if len(sp)==2:
> target_prefix=sp[1]
> sys.path.insert(0,os.path.join(target_prefix,'lib','python%i.%i' %
> sys.version_info[:2],'site-packages'))
> from numpy.distutils.core import Extension
> import sys
>
> sources = """
> Src/msuweight.f
> """.split()
>
> extra_link_args=[]
> if sys.platform=='darwin':
> extra_link_args = ['-bundle','-bundle_loader '+sys.prefix+'/bin/
> python']
> ext1 = Extension(name = 'eqmsu',
> extra_link_args=extra_link_args,
> sources = ['Src/eqmsu.pyf',]+sources)
>
> if __name__ == "__main__":
> from numpy.distutils.core import setup
> setup(name = 'MSU',
> ext_modules = [ext1,],
> packages = ['MSU'],
> package_dir = {'MSU': 'Lib',
> },
> )
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
More information about the Scipy-dev
mailing list