[Numpy-discussion] [PATCH] F2Py on Python 3

Lisandro Dalcin dalcinl@gmail....
Fri Sep 24 16:31:00 CDT 2010


On 23 September 2010 23:34, Charles R Harris <charlesr.harris@gmail.com> wrote:
>
>
> On Thu, Sep 23, 2010 at 7:22 PM, Lisandro Dalcin <dalcinl@gmail.com> wrote:
>>
>> On 23 September 2010 01:26, Charles R Harris <charlesr.harris@gmail.com>
>> wrote:
>> >
>> >
>> > On Wed, Sep 22, 2010 at 10:00 PM, Charles R Harris
>> > <charlesr.harris@gmail.com> wrote:
>> >>
>> >>
>> >> On Wed, Sep 22, 2010 at 9:14 PM, Fernando Perez <fperez.net@gmail.com>
>> >> wrote:
>> >>>
>> >>> On Wed, Sep 22, 2010 at 7:16 PM, Charles R Harris
>> >>> <charlesr.harris@gmail.com> wrote:
>> >>> >
>> >>> > Done in  29cccb6.
>> >>> >
>> >>>
>> >>> Mmh, I think it broke something:
>> >>>
>> >>>  File
>> >>> "/home/fperez/tmp/src/scipy/numpy/numpy/distutils/command/build.py",
>> >>> line 37, in run
>> >>>    old_build.run(self)
>> >>>  File "/usr/lib/python2.6/distutils/command/build.py", line 135, in
>> >>> run
>> >>>    self.run_command(cmd_name)
>> >>>  File "/usr/lib/python2.6/distutils/cmd.py", line 333, in run_command
>> >>>    self.distribution.run_command(command)
>> >>>  File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
>> >>>    cmd_obj.run()
>> >>>  File
>> >>>
>> >>> "/home/fperez/tmp/src/scipy/numpy/numpy/distutils/command/build_scripts.py",
>> >>> line 39, in run
>> >>>    self.scripts = self.generate_scripts(self.scripts)
>> >>>  File
>> >>>
>> >>> "/home/fperez/tmp/src/scipy/numpy/numpy/distutils/command/build_scripts.py",
>> >>> line 24, in generate_scripts
>> >>>    script = func(build_dir)
>> >>>  File "numpy/f2py/setup.py", line 78, in generate_f2py_py
>> >>>    '''%(os.path.basename(sys.executable)))
>> >>> TypeError: not enough arguments for format string
>> >>>
>> >>> If I revert to the previous commit, it installs fine again.
>> >>>
>> >>
>> >> I wondered about that, it is probably the old `mode` vs  plain old
>> >> mode. I
>> >> had just hoped it was tested. Can you check that out?
>> >>
>> >
>> > Should be fixed in 8f6114b.
>> >
>>
>> I had just hoped it was tested... [sorry, I could not resist! ;-) ]
>>
>> diff --git a/numpy/f2py/setup.py b/numpy/f2py/setup.py
>> index aac3d33..37aab19 100644
>> --- a/numpy/f2py/setup.py
>> +++ b/numpy/f2py/setup.py
>> @@ -62,7 +62,7 @@ for mode in ["g3-numpy", "2e-numeric",
>> "2e-numarray", "2e-numpy
>>     except ValueError: pass
>>  os.environ["NO_SCIPY_IMPORT"]="f2py"
>>  if mode=="g3-numpy":
>> -    sys.stderr.write("G3 f2py support is not implemented, yet.\n")
>> +    sys.stderr.write("G3 f2py support is not implemented, yet.\\n")
>>     sys.exit(1)
>>  elif mode=="2e-numeric":
>>     from f2py2e import main
>> @@ -72,7 +72,7 @@ elif mode=="2e-numarray":
>>  elif mode=="2e-numpy":
>>     from numpy.f2py import main
>>  else:
>> -    sys.stderr.write("Unknown mode: " + repr(mode) + "\n")
>> +    sys.stderr.write("Unknown mode: " + repr(mode) + "\\n")
>>     sys.exit(1)
>>  main()
>>  '''%(os.path.basename(sys.executable)))
>>
>
> Arrggghhhh, I forgot the double backslashes :-(
>

Cython does a lot of stuff like this (though it generates C code), and
I prefer use raw string prefixes when hacking on it. These backslash
scapes are nightmare for my brain to parse, plus it is very easy for
yourself or others to make a mistake later.



-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169


More information about the NumPy-Discussion mailing list