[Python-Dev] Compiling 2.7.2 on OS/2

2012-01-05 Thread Paul Smedley

Hi All,

I'm working on updating my port of Python 2.6.5 to v2.7.2 for the OS/2 
platform.


I have python.exe and python27.dll compiling find, but when starting to 
build sharedmods I'm getting the following error:

running build
running build_ext
Traceback (most recent call last):
  File "./setup.py", line 2092, in 
main()
  File "./setup.py", line 2087, in main
'Lib/smtpd.py']
  File "U:/DEV/python-2.7.2/Lib/distutils/core.py", line 152, in setup
dist.run_commands()
  File "U:/DEV/python-2.7.2/Lib/distutils/dist.py", line 953, in 
run_commands

self.run_command(cmd)
  File "U:/DEV/python-2.7.2/Lib/distutils/dist.py", line 972, in 
run_command

cmd_obj.run()
  File "U:/DEV/python-2.7.2/Lib/distutils/command/build.py", line 127, 
in run

self.run_command(cmd_name)
  File "U:/DEV/python-2.7.2/Lib/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
  File "U:/DEV/python-2.7.2/Lib/distutils/dist.py", line 972, in 
run_command

cmd_obj.run()
  File "U:/DEV/python-2.7.2/Lib/distutils/command/build_ext.py", line 
340, in run

self.build_extensions()
  File "./setup.py", line 152, in build_extensions
missing = self.detect_modules()
  File "./setup.py", line 1154, in detect_modules
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
AttributeError: 'NoneType' object has no attribute 'split'
make: *** [sharedmods] Error 1


Any suggestions?  A google showed a similar error on AIX with no clear 
resolution.


Thanks in advance,

Paul

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-05 Thread Paul Smedley

Hi Amaury,

On 06/01/12 00:32, Amaury Forgeot d'Arc wrote:

2012/1/5 Paul Smedley mailto:p...@smedley.id.au>>

Hi All,

I'm working on updating my port of Python 2.6.5 to v2.7.2 for the
OS/2 platform.

I have python.exe and python27.dll compiling find, but when starting
to build sharedmods I'm getting the following error:
running build
running build_ext
Traceback (most recent call last):
  File "./setup.py", line 2092, in 
main()
  File "./setup.py", line 2087, in main
'Lib/smtpd.py']
  File "U:/DEV/python-2.7.2/Lib/__distutils/core.py", line 152, in setup
dist.run_commands()
  File "U:/DEV/python-2.7.2/Lib/__distutils/dist.py", line 953, in
run_commands
self.run_command(cmd)
  File "U:/DEV/python-2.7.2/Lib/__distutils/dist.py", line 972, in
run_command
cmd_obj.run()
  File "U:/DEV/python-2.7.2/Lib/__distutils/command/build.py", line
127, in run
self.run_command(cmd_name)
  File "U:/DEV/python-2.7.2/Lib/__distutils/cmd.py", line 326, in
run_command
self.distribution.run_command(__command)
  File "U:/DEV/python-2.7.2/Lib/__distutils/dist.py", line 972, in
run_command
cmd_obj.run()
  File "U:/DEV/python-2.7.2/Lib/__distutils/command/build_ext.__py",
line 340, in run
self.build_extensions()
  File "./setup.py", line 152, in build_extensions
missing = self.detect_modules()
  File "./setup.py", line 1154, in detect_modules
for arg in sysconfig.get_config_var("__CONFIG_ARGS").split()]
AttributeError: 'NoneType' object has no attribute 'split'
make: *** [sharedmods] Error 1


Any suggestions?  A google showed a similar error on AIX with no
clear resolution.


Is it in the part that configures the "dbm" module?
This paragraph is already protected by a "if platform not in ['cygwin']:",
I suggest to exclude 'os2emx' as well.


It is - however adding os2 the the list of platforms to the ones to 
exclude gets me only a little further:


It then bombs with:
running build
running build_ext
Traceback (most recent call last):
  File "./setup.py", line 2092, in 
main()
  File "./setup.py", line 2087, in main
'Lib/smtpd.py']
  File "U:/DEV/python-2.7.2/Lib/distutils/core.py", line 152, in setup
dist.run_commands()
  File "U:/DEV/python-2.7.2/Lib/distutils/dist.py", line 953, in 
run_commands

self.run_command(cmd)
  File "U:/DEV/python-2.7.2/Lib/distutils/dist.py", line 972, in 
run_command

cmd_obj.run()
  File "U:/DEV/python-2.7.2/Lib/distutils/command/build.py", line 127, 
in run

self.run_command(cmd_name)
  File "U:/DEV/python-2.7.2/Lib/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
  File "U:/DEV/python-2.7.2/Lib/distutils/dist.py", line 972, in 
run_command

cmd_obj.run()
  File "U:/DEV/python-2.7.2/Lib/distutils/command/build_ext.py", line 
340, in run

self.build_extensions()
  File "./setup.py", line 152, in build_extensions
missing = self.detect_modules()
  File "./setup.py", line 1368, in detect_modules
if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
TypeError: argument of type 'NoneType' is not iterable
make: *** [sharedmods] Error 1

Which again points to problems with sysconfig.get_config_var("CONFIG_ARGS"):

Thanks,

Paul

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-05 Thread Paul Smedley

Hi Terry,

On 06/01/12 10:25, Terry Reedy wrote:

On 1/5/2012 3:01 PM, Paul Smedley wrote:


File "./setup.py", line 1154, in detect_modules
for arg in sysconfig.get_config_var("__CONFIG_ARGS").split()]
AttributeError: 'NoneType' object has no attribute 'split'
make: *** [sharedmods] Error 1



File "./setup.py", line 1368, in detect_modules
if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
TypeError: argument of type 'NoneType' is not iterable
make: *** [sharedmods] Error 1

Which again points to problems with
sysconfig.get_config_var("CONFIG_ARGS"):


[The earlier call was with "__CONFIG_ARGS", for whatever difference that
makes.] It appears to be returning None instead of [] (or a populated
list).

In 3.2.2, at line 579 of sysconfig.py is
def get_config_var(name):
return get_config_vars().get(name)

That defaults to None if name is not a key in the dict returned by
get_config_vars(). My guess is that it always is and and the the value
is always a list for tested win/*nix/mac systems. So either setup.py has
the bug of assuming that there is always a list value for "CONFIG_ARGS"
or sysconfig.py has the bug of not setting it for os2, perhaps because
of a bug elsewhere.

At line 440 of sysconfig.py is
def get_config_var(*args):
global _CONFIG_VARS
if _CONFIG_VARS is None:
_CONFIG_VARS = {}

if os.name in ('nt', 'os2'):
_init_non_posix(_CONFIG_VARS)
if args:
vals = []
for name in args:
vals.append(_CONFIG_VARS.get(name))
return vals
else:
return _CONFIG_VARS

At 456 is
def _init_non_posix(vars):
"""Initialize the module as appropriate for NT"""
# set basic install directories
...

"CONFIG_ARGS" is not set explicitly for any system anywhere in the file,
so I do not know how the call ever works.
This looks pretty much the same as the code in 2.7.2 - I don't 
understand Python code well enough to debug the script :(


Thanks for the response,

Paul



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] What's required to keep OS/2 support in Python 3.3

2012-01-06 Thread Paul Smedley

Hi All,

I'm a little slow in responding to 
http://blog.python.org/2011/05/python-33-to-drop-support-for-os2.html, 
but I'm interested in stepping up to help maintain OS/2 support in 
Python 3.3 and above.


I've been building Python 2.x for a while, and currently have binaries 
of 2.6.5 available from http://os2ports.smedley.info


Unlike Andrew Mcintyre, I'm using libc for development 
(http://svn.netlabs.org/libc) rather than emx.  libc is still being 
developed whereas emx hasn't been updated in about 10 years.


I haven't attempted a build of 3.x yet, but will grab the latest 3.x 
release and see what it takes to get it building here.  I expect I'll 
hit the same problem with sysconfig.get_config_var("CONFIG_ARGS"): as 
with 2.7.2 but we'll wait and see.


Cheers,

Paul

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What's required to keep OS/2 support in Python 3.3

2012-01-06 Thread Paul Smedley

Hi All,

On 06/01/12 19:22, Paul Smedley wrote:

I'm a little slow in responding to
http://blog.python.org/2011/05/python-33-to-drop-support-for-os2.html,
but I'm interested in stepping up to help maintain OS/2 support in
Python 3.3 and above.

I've been building Python 2.x for a while, and currently have binaries
of 2.6.5 available from http://os2ports.smedley.info

Unlike Andrew Mcintyre, I'm using libc for development
(http://svn.netlabs.org/libc) rather than emx. libc is still being
developed whereas emx hasn't been updated in about 10 years.

I haven't attempted a build of 3.x yet, but will grab the latest 3.x
release and see what it takes to get it building here. I expect I'll hit
the same problem with sysconfig.get_config_var("CONFIG_ARGS"): as with
2.7.2 but we'll wait and see.


I now have a dll and exe - however when it tried to build the modules, 
it dies with:

Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: no codec search functions registered: can't find encoding


Have done a small amount of debugging:
in get_codeset(), char* codeset = nl_langinfo(CODESET);
returns: ISO8859-1

Which can't be found by:
codec = _PyCodec_Lookup(encoding);

from
get_codec_name(const char *encoding)

Where is the list of valid codepages read from? Should ISO8859-1 be 
valid? I see some references to ISO-8859-1 in the code but not ISO8859-1


TIA,

Paul

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What's required to keep OS/2 support in Python 3.3

2012-01-06 Thread Paul Smedley

Hi Antoine,
On 07/01/12 06:58, Antoine Pitrou wrote:

On Sat, 07 Jan 2012 06:28:00 +1030
Paul Smedley  wrote:


I now have a dll and exe - however when it tried to build the modules,
it dies with:
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to[:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding


I would look at this line:


LookupError: no codec search functions registered: can't find encoding


Normally the standard codec search function is registered when
importing the "encodings" module (see Lib/encodings/__init__.py), which
is done at the end of _PyCodecRegistry_Init() in Python/codecs.c.
There's this comment there:

 /* Ignore ImportErrors... this is done so that
distributions can disable the encodings package. Note
that other errors are not masked, e.g. SystemErrors
raised to inform the user of an error in the Python
configuration are still reported back to the user. */

For the purpose of debugging you could *not* ignore the error and
instead print it out or bail out.

Thanks - commenting out the ImportErrors block, I get:
ImportError: No module named encodings

So seems it's not finding modules - possibly related to the warnings about:
>> Could not find platform independent libraries
>> Could not find platform dependent libraries

Seems getenv() may not be working correctly...

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-07 Thread Paul Smedley

Hi All,

On 06/01/12 10:25, Terry Reedy wrote:

On 1/5/2012 3:01 PM, Paul Smedley wrote:


File "./setup.py", line 1154, in detect_modules
for arg in sysconfig.get_config_var("__CONFIG_ARGS").split()]
AttributeError: 'NoneType' object has no attribute 'split'
make: *** [sharedmods] Error 1



File "./setup.py", line 1368, in detect_modules
if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
TypeError: argument of type 'NoneType' is not iterable
make: *** [sharedmods] Error 1

Which again points to problems with
sysconfig.get_config_var("CONFIG_ARGS"):


[The earlier call was with "__CONFIG_ARGS", for whatever difference that
makes.] It appears to be returning None instead of [] (or a populated
list).

In 3.2.2, at line 579 of sysconfig.py is
def get_config_var(name):
return get_config_vars().get(name)

That defaults to None if name is not a key in the dict returned by
get_config_vars(). My guess is that it always is and and the the value
is always a list for tested win/*nix/mac systems. So either setup.py has
the bug of assuming that there is always a list value for "CONFIG_ARGS"
or sysconfig.py has the bug of not setting it for os2, perhaps because
of a bug elsewhere.

At line 440 of sysconfig.py is
def get_config_var(*args):
global _CONFIG_VARS
if _CONFIG_VARS is None:
_CONFIG_VARS = {}

if os.name in ('nt', 'os2'):
_init_non_posix(_CONFIG_VARS)
if args:
vals = []
for name in args:
vals.append(_CONFIG_VARS.get(name))
return vals
else:
return _CONFIG_VARS

At 456 is
def _init_non_posix(vars):
"""Initialize the module as appropriate for NT"""
# set basic install directories
...

"CONFIG_ARGS" is not set explicitly for any system anywhere in the file,
so I do not know how the call ever works.


using _init_posix() for 'os2' instead of _init_non_posix is the fix for 
this.


sysconfig.py also needs the following changes:
--- \dev\Python-2.7.2-o\Lib\sysconfig.py2012-01-06 19:27:14.0 
+1030
+++ sysconfig.py2012-01-07 19:03:00.0 +1030
@@ -46,7 +46,7 @@
 'scripts': '{base}/Scripts',
 'data'   : '{base}',
 },
-'os2_home': {
+'os2_user': {
 'stdlib': '{userbase}/lib/python{py_version_short}',
 'platstdlib': '{userbase}/lib/python{py_version_short}',
 'purelib': 
'{userbase}/lib/python{py_version_short}/site-packages',

@@ -413,9 +413,9 @@
 _CONFIG_VARS['platbase'] = _EXEC_PREFIX
 _CONFIG_VARS['projectbase'] = _PROJECT_BASE

-if os.name in ('nt', 'os2'):
+if os.name in ('nt'):
 _init_non_posix(_CONFIG_VARS)
-if os.name == 'posix':
+if os.name in ('posix', 'os2'):
 _init_posix(_CONFIG_VARS)

 # Setting 'userbase' is done below the call to the





___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-07 Thread Paul Smedley

Hi Terry,

On 07/01/12 19:47, Terry Reedy wrote:

On 1/7/2012 3:48 AM, Paul Smedley wrote:


using _init_posix() for 'os2' instead of _init_non_posix is the fix for
this.

sysconfig.py also needs the following changes:
--- \dev\Python-2.7.2-o\Lib\sysconfig.py 2012-01-06 19:27:14.0
+1030
+++ sysconfig.py 2012-01-07 19:03:00.0 +1030
@@ -46,7 +46,7 @@
'scripts': '{base}/Scripts',
'data' : '{base}',
},
- 'os2_home': {
+ 'os2_user': {
'stdlib': '{userbase}/lib/python{py_version_short}',
'platstdlib': '{userbase}/lib/python{py_version_short}',
'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
@@ -413,9 +413,9 @@
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
_CONFIG_VARS['projectbase'] = _PROJECT_BASE

- if os.name in ('nt', 'os2'):
+ if os.name in ('nt'):
_init_non_posix(_CONFIG_VARS)
- if os.name == 'posix':
+ if os.name in ('posix', 'os2'):
_init_posix(_CONFIG_VARS)


Submit a patch on the tracker, preferably as a file rather than cut and
paste.

Will do right now.

Cheers,

Paul



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What's required to keep OS/2 support in Python 3.3

2012-01-08 Thread Paul Smedley

On 07/01/12 08:22, Paul Smedley wrote:

For the purpose of debugging you could *not* ignore the error and
instead print it out or bail out.

Thanks - commenting out the ImportErrors block, I get:
ImportError: No module named encodings


OK got through this - PYTHONPATH in makefile was borked for OS/2 (: 
separators vs ; which don't work so well with drive letters)


Now having trouble importing the _io module even though it's builtin 

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What's required to keep OS/2 support in Python 3.3

2012-01-08 Thread Paul Smedley

On 08/01/12 19:07, Paul Smedley wrote:

On 07/01/12 08:22, Paul Smedley wrote:

For the purpose of debugging you could *not* ignore the error and
instead print it out or bail out.

Thanks - commenting out the ImportErrors block, I get:
ImportError: No module named encodings


OK got through this - PYTHONPATH in makefile was borked for OS/2 (:
separators vs ; which don't work so well with drive letters)

Now having trouble importing the _io module even though it's builtin 


to be clear, the error is:
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "U:/DEV/python-3.2.2/Lib/io.py", line 60, in 

Killed by SIGABRT


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What's required to keep OS/2 support in Python 3.3

2012-01-08 Thread Paul Smedley

On 08/01/12 19:12, Paul Smedley wrote:

On 08/01/12 19:07, Paul Smedley wrote:

On 07/01/12 08:22, Paul Smedley wrote:

For the purpose of debugging you could *not* ignore the error and
instead print it out or bail out.

Thanks - commenting out the ImportErrors block, I get:
ImportError: No module named encodings


OK got through this - PYTHONPATH in makefile was borked for OS/2 (:
separators vs ; which don't work so well with drive letters)

Now having trouble importing the _io module even though it's builtin



to be clear, the error is:
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "U:/DEV/python-3.2.2/Lib/io.py", line 60, in 

Killed by SIGABRT



 and it's dying in _iomodule.c at:

/* put os in the module state */
state->os_module = PyImport_ImportModule("os");
if (state->os_module == NULL){
fprintf(stderr,"_iomodule fail\n");
goto fail;}

for some reason.. at least I'm slowly making progress :P (I think)

Cheers,

Paul

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com