Python 2.6 and deprecated modules

Lisandro Dalcin dalcinl at gmail.com
Mon Jul 13 16:56:08 CDT 2009


On Mon, Jul 13, 2009 at 6:47 PM, Matt Knepley<knepley at gmail.com> wrote:
> I like 1) as well. However someone needs to test the fixes on ancient RH
> python.
>

No problem, I have custom installs of old Python's starting from 2.3
and up to current SVN trunk (2.7)... Do you remember what version is
the ancient RH Python you are talking about?


>  Matt
>
> From the phone
>
> On Jul 13, 2009, at 1:15 PM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>
>> Fedora 11 moved to Python 2.6. Now many Python stdlib modules are
>> deprecated (as part of the transition to Python 3.x series).
>>
>> /u/dalcinl/Devel/PETSc/petsc-dev/config/BuildSystem/config/compilers.py:7:
>> DeprecationWarning: the sets module is deprecated
>>  import sets
>> /u/dalcinl/Devel/PETSc/petsc-dev/config/PETSc/package.py:7:
>> DeprecationWarning: the md5 module is deprecated; use hashlib instead
>>  import md5
>> /u/dalcinl/Devel/PETSc/petsc-dev/config/BuildSystem/script.py:101:
>> DeprecationWarning: The popen2 module is deprecated.  Use the
>> subprocess module.
>>  import popen2
>>
>> We could take two approaches to remove these warnings (I bet all you
>> hate warnings as much as me):
>>
>> 1) Reimplement things using the modern API's, perhaps by using
>> conditional code depending on the Python version and/or using import
>> with try/except blocks. In particular, this will require:
>> a) use the builtin 'set' type (available since Python 2.4)
>> b) use the 'hashlib' module (available since Python 2.5)
>> c) moving from using 'peopen2' to 'subprocess' (BTW, available since
>> Python2.4) will likely remove the need to use 'select', which I
>> commented some time ago it is not supported (for pipes) in native
>> Windows Python (yes, some day I'll have some working code with the
>> native Windows Python).
>>
>> 2) Silent these warnings. I do not think these modules will be ever
>> removed from 2.x series, and porting the whole BuildSystem beast to
>> Python 3.0 is not going to be a 10-minutes task anyway.
>>
>>
>> I personally prefer (1) and volunteer to provide the fixes, even if
>> that is more work than (2). I would like to know your opinions before
>> start to work on this.
>>
>>
>> --
>> Lisandro Dalcín
>> ---------------
>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>> Tel/Fax: +54-(0)342-451.1594
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594



More information about the petsc-dev mailing list