Re: [Python-Dev] add bool type to optparse

2007-07-31 Thread A.M. Kuchling
On Mon, Jul 30, 2007 at 09:50:38AM -0400, Neal Becker wrote:
> Subject says it all.

Why is boolean support needed, given that optparse has store_true and
store_false actions?  Example usage:

parser.add_option('--confirm', action='store_true', dest='confirm')

--amk

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


Re: [Python-Dev] add bool type to optparse

2007-07-31 Thread Neal Becker
A.M. Kuchling wrote:

> On Mon, Jul 30, 2007 at 09:50:38AM -0400, Neal Becker wrote:
>> Subject says it all.
> 
> Why is boolean support needed, given that optparse has store_true and
> store_false actions?  Example usage:
> 
> parser.add_option('--confirm', action='store_true', dest='confirm')
> 
> --amk

So you can do:
--option=false

Otherwise you have to do something like:
(action='store_false', default=True)

and use:
--no-option

which is OK sometimes, but why not allow a choice?

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


Re: [Python-Dev] add bool type to optparse

2007-07-31 Thread Guido van Rossum
Why not submit a patch to Greg Ward? http://optik.sourceforge.net/

On 7/31/07, Neal Becker <[EMAIL PROTECTED]> wrote:
> A.M. Kuchling wrote:
>
> > On Mon, Jul 30, 2007 at 09:50:38AM -0400, Neal Becker wrote:
> >> Subject says it all.
> >
> > Why is boolean support needed, given that optparse has store_true and
> > store_false actions?  Example usage:
> >
> > parser.add_option('--confirm', action='store_true', dest='confirm')
> >
> > --amk
>
> So you can do:
> --option=false
>
> Otherwise you have to do something like:
> (action='store_false', default=True)
>
> and use:
> --no-option
>
> which is OK sometimes, but why not allow a choice?
>
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Extending Python by Adding Keywords & Data types

2007-07-31 Thread Vishak Srinivas
HI all,

I am using python v2.5 and I am an amateur working on python. I am extending
python for my research work and would like some help and guidance w.r.t this
matter from you experienced python developers.

II want to add some more KEYWORDS and DATATYPES into the python script apart
from the existing ones.

It would be really great if anybody could guide me as which files and
modules I need to look to make these additions and enhancements to the
existing python version. Thanks a lot in advance and your help is really
appreciated.

Vishak

-- 
--
Vishak
PhD Grad Student.

We are what we repeatedly do. Excellence, then, is not an act but a habit. -
Aristotle
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Extending Python by Adding Keywords & Data types

2007-07-31 Thread Aahz
On Tue, Jul 31, 2007, Vishak Srinivas wrote:
>
> I am using python v2.5 and I am an amateur working on python. I am extending
> python for my research work and would like some help and guidance w.r.t this
> matter from you experienced python developers.
> 
> II want to add some more KEYWORDS and DATATYPES into the python script apart
> from the existing ones.
> 
> It would be really great if anybody could guide me as which files and
> modules I need to look to make these additions and enhancements to the
> existing python version. Thanks a lot in advance and your help is really
> appreciated.

python-dev is probably not the right place for this discussion.  You have
three good options:

* If you want to propose new keywords and types to get included into the
base language, you should use the python-ideas list.

* If you're doing this for yourself, use comp.lang.python or the capi-sig
list.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

This is Python.  We don't care much about theory, except where it intersects 
with useful practice.  
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Python Package Index hostname change

2007-07-31 Thread Martin v. Löwis
The Python Packaging Index (the software formerly known
as Cheeseshop) is now available at

http://pypi.python.org/pypi

The old addresses (www.python.org/pypi, and
cheeseshop.python.org/pypi) will continue to work,
either as aliases or using HTTP redirections.

The software was renamed to its old name
(PyPI - Python Package Index), as the Cheeseshop
name was ever confusing people unfamiliar with
British television comedy sketch (and puzzling
even to people familiar with the sketch, as
you *can* get packages from the package index).

If you would like to discuss PyPI and its future,
please join [EMAIL PROTECTED]

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Extending Python by Adding Keywords & Data types

2007-07-31 Thread Martin v. Löwis
> II want to add some more KEYWORDS and DATATYPES into the python script
> apart from the existing ones.

In addition to what Aahz said: take a look at PEP 306 for adding
keywords. If you don't understand it, *don't* ask here, but on
comp.lang.python instead.

For adding new datatypes, look at xxmodule.c. The same disclaimer
applies: if you have any questions about that, don't ask here.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Cygwin: Problem detecting subprocess termination after _spawn_posix in distutils?

2007-07-31 Thread Martin v. Löwis
> It would be really nice if test_distutils showed any failures, but it 
> doesn't so any assistance would be welcome. At this point I can't even 
> replicate the failure in a simpler test :-(

My guess is that it's the environment; if not that, the working
directory. Assuming you have already instrumented
ccompiler.CCompiler.spawn, I suggest to dump os.environ and
print os.getcwd(). Assuming you really meant that you run under
Cygwin Python (instead of just using --compiler), you might
want to instrument spawn._spawn_posix instead.

When you say you extracted _spawn_all from distutils/spawn.py:
what version of Python are you talking about? I can't find
_spawn_all in the sources of 2.5.x, or 2.6.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python Package Index hostname change

2007-07-31 Thread Lisandro Dalcin
On 7/31/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> The Python Packaging Index (the software formerly known
> as Cheeseshop) is now available at
>
> http://pypi.python.org/pypi

Please, update 'DEFAULT_REPOSITORY' in Lib/distutils/command/upload.py
(py-2.6 and py3k-struni branches)


-- 
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
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Cygwin: Problem detecting subprocess termination after _spawn_posix in distutils?

2007-07-31 Thread Steve Holden
Martin v. Löwis wrote:
>> It would be really nice if test_distutils showed any failures, but it 
>> doesn't so any assistance would be welcome. At this point I can't even 
>> replicate the failure in a simpler test :-(
> 
> My guess is that it's the environment; if not that, the working
> directory. Assuming you have already instrumented
> ccompiler.CCompiler.spawn, I suggest to dump os.environ and
> print os.getcwd(). Assuming you really meant that you run under
> Cygwin Python (instead of just using --compiler), you might
> want to instrument spawn._spawn_posix instead.
> 
> When you say you extracted _spawn_all from distutils/spawn.py:
> what version of Python are you talking about? I can't find
> _spawn_all in the sources of 2.5.x, or 2.6.
> 
Thanks for taking the time to have a look at this.

Sorry, it *was* _spawn_posix I extracted (and have instrumented in the 
live version) - I have no idea where "_spawn_all" came from. I am indeed 
running under Cygwin Python.

Here-s a diff -u output against the original spawn.py so you can see 
what I have changed.

$ diff -u /lib/python2.5/distutils/{spawn.py.org,spawn.py}
--- /lib/python2.5/distutils/spawn.py.org   2007-07-14 
09:09:24.114921600 -0400
+++ /lib/python2.5/distutils/spawn.py   2007-07-31 20:53:33.325945600 -0400
@@ -118,7 +118,9 @@
search_path=1,
verbose=0,
dry_run=0):
-
+for _k in sorted(os.environ.keys()):
+print "%s=%s" % (_k, os.environ[_k])
+print "SPAWN:", cmd, "PATH?", search_path, "V:", verbose, "D:", dry_run
  log.info(string.join(cmd, ' '))
  if dry_run:
  return
@@ -144,20 +146,25 @@
  # Loop until the child either exits or is terminated by a signal
  # (ie. keep waiting if it's merely stopped)
  while 1:
+print "Are we done yet? Waiting on pid", pid
  try:
  (pid, status) = os.waitpid(pid, 0)
+print "Got pid, status", pid, status
  except OSError, exc:
  import errno
+print "Got OSError", exc.errno
  if exc.errno == errno.EINTR:
  continue
  raise DistutilsExecError, \
"command '%s' failed: %s" % (cmd[0], exc[-1])
  if os.WIFSIGNALED(status):
+print "Got WIFSIGNALED", status
  raise DistutilsExecError, \
"command '%s' terminated by signal %d" % \
(cmd[0], os.WTERMSIG(status))

  elif os.WIFEXITED(status):
+print "Got WIFEXITED", status
  exit_status = os.WEXITSTATUS(status)
  if exit_status == 0:
  return  # hey, it succeeded!
@@ -167,9 +174,11 @@
(cmd[0], exit_status)

  elif os.WIFSTOPPED(status):
+print "Got WIFSTOPPED", status
  continue

  else:
+print "Got unknown exception", status
  raise DistutilsExecError, \
"unknown error executing '%s': termination 
status %d" % \

(cmd[0], status)

The output now includes the environment:

$ python setup.py install
running install
running build
running build_py
running build_ext
building '_imaging' extension
!::=::\
!C:=C:\cygwin\bin
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\sholden\Application Data
APR_ICONV_PATH=C:\Program Files\Subversion\iconv
CDPATH=.:/c/Steve:/c/Steve/Projects:/usr/local
CLIENTNAME=Console
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMPUTERNAME=BIGBOY
COMSPEC=C:\WINDOWS\system32\cmd.exe
CVSROOT=/usr/local/repository/
CVS_RSH=/bin/ssh
FP_NO_HOST_CHECK=NO
HOME=/c/Steve
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\sholden
HOSTNAME=bigboy
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:
LANG=C
LOGONSERVER=\\BIGBOY
MAKE_MODE=unix
MANPATH=/usr/local/man:/usr/share/man:/usr/man::/usr/ssl/man
NUMBER_OF_PROCESSORS=1
OLDPWD=/c/Steve
OS=Windows_NT
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/c/WINDOWS/system32:/c/WINDOWS:
/c/WINDOWS/System32/Wbem:/c/Program Files/ATI Technologies/ATI Control 
Panel:/c/
Program Files/Common Files/GTK/2.0/bin:/c/Program 
Files/Subversion/bin:/c/Python
25:/c/Steve/bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PLAT=cygwin-1.5.24-i686
PRINTER=HP Photosmart C6100 series
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0d06
PROGRAMFILES=C:\Program Files
PROMPT=$P$G
PS1=\[\e]0;[EMAIL PROTECTED] \[\e[33m\]\w\[\e[0m\]\n\$
PWD=/c/Steve/Imaging-1.1.6
PYSVN=svn+ssh://[EMAIL PROTECTED]/
PYTHONSTARTUP=/c/Steve/.pythonrc
SESSIONNAME=Console
SHLVL=1
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=/c/DOCUME~1/sholden/LOCALS~1/Temp
TERM=cygwin
TMP=/c/DOCUME~1/sholden/LOCALS~1/Temp
U

Re: [Python-Dev] Python Package Index hostname change

2007-07-31 Thread Guido van Rossum
And why not in the upcoming 2.5 release as well?

On 7/31/07, Lisandro Dalcin <[EMAIL PROTECTED]> wrote:
> On 7/31/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > The Python Packaging Index (the software formerly known
> > as Cheeseshop) is now available at
> >
> > http://pypi.python.org/pypi
>
> Please, update 'DEFAULT_REPOSITORY' in Lib/distutils/command/upload.py
> (py-2.6 and py3k-struni branches)
>
>
> --
> 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
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python Package Index hostname change

2007-07-31 Thread Martin v. Löwis
Guido van Rossum schrieb:
> And why not in the upcoming 2.5 release as well?

It's changed there as well.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python Package Index hostname change

2007-07-31 Thread Martin v. Löwis
> Please, update 'DEFAULT_REPOSITORY' in Lib/distutils/command/upload.py
> (py-2.6 and py3k-struni branches)

I did already, for 2.6, in r56543. For the other branches, this change
will propagate through merging.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Cygwin: Problem detecting subprocess termination after _spawn_posix in distutils?

2007-07-31 Thread Martin v. Löwis
> The only environment variables that don't appear in the shell output 
> from the env command are INFOPATH, MAKE_MODE and PLAT. I am still flummoxed.

At this point, I'd recommend to perform a cygwin update; with Cygwin,
these problems often go away with an update.

If that doesn't help, you can ask on the Cygwin list also; to analyse
this further, ISTM one will need to debug the internals of cygwin.

One thing you could try is to add -v to the list of gcc options;
you can then see whether gcc is progressing correctly.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com