[issue10466] locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)

2011-05-07 Thread Jan Killian

Changes by Jan Killian :


--
nosy: +iki

___
Python tracker 
<http://bugs.python.org/issue10466>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2011-01-03 Thread Jan Killian

Jan Killian  added the comment:

Hello All,

sorry for lack of communication recently, I'd alos like to see it in 3.2 
instead of 3.3, but my time is not as scalable as I wish and I can't run on 
clouds yet .)

I like Trent's module and especially its usefullness via the commandline. I'm 
also happy about learning on "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App 
Paths\\" key, and did reimplement it in my module (with optional static=True 
parameter to cache the key and parsed path instead of querying and parsing them 
on each run).

For inclusion in shutil, I'd imho prefer the interface chosen here, ie. 
which_files() returns generator, which() returns first match, or raises 
IOError(errno.ENOENT), but that's my opinion only. There's also adapted the 
default extension list to match the given Windows version, which helps 
resembling the real command execution behavior.

The escape+quote chars in path are an interesting problem. I wrote a simple 
test for them to find out the behavior on Windows XP/7 and Linux, and will do 
the correct implementation and tests later this week.

--

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-03-04 Thread Jan Killian

Jan Killian  added the comment:

Adapted Brian Curtin's http://bugs.python.org/file15381/
shutil_which.patch and made another reference implementation as a standalone 
module including the following fixes:

* uses ``PATHEXT`` on Windows
* searches current directory before ``PATH`` on Windows, but not before an 
explicitly passed path
* accepts both string or iterable for an explicitly passed path, or pathext
* accepts an explicitly passed empty path, or pathext (either '' or [])
* does not search ``PATH`` for files that have a path specified in their name 
already

Use any of these changes in the final shutil patch if you like to. The shutil 
module has availability 'Unix, Windows' after all.

--
nosy: +iki
Added file: http://bugs.python.org/file16441/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-03-05 Thread Jan Killian

Jan Killian  added the comment:

Updated version of reference implementation as a standalone module
* changed interface: which_files() returns generator, which() returns first 
match,
  or raises IOError(errno.ENOENT)
* updated doctest

Made this to more closely resemble the 'which' command behavior, and to make 
the typical use case simpler. The generator interface is still a good idea 
imho, so it's kept as which_files(). I'm already using the reference 
implementation module flawlessly, so I don't see any other changes needed on my 
side. Your ideas are welcome of course.

--
Added file: http://bugs.python.org/file16459/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-09 Thread Jan Killian

Jan Killian  added the comment:

@tarek:

Sorry for not reacting, it completely vaporized out of my head. I'll do the 
patch this weekend.

Agree, only which/which_files belong to public API.

Regarding PATHEXT:

1. When a new process is created, the value is taken from registry variable 
PATHEXT in the 'HKCU\Environment' key, or the 
'HKLM\System\CurrentControlSet\Control\Session Manager\Environment' key (in 
this order). The first key is for custom user values, and PATHEXT is not set by 
default there. The second key is a system-wide setting and defaults to:
A. ".COM;.EXE;.BAT;.CMD" in Windows NT, and possibly also W2K (although it is 
already 5.0 version)
B. ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH" in Wine [01], XP and WS 
2003 [02]
C. ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" in Vista and W7 and 
possibly also WS 2008.

2. When the PATHEXT is missing, or is set to be empty in registry, or  is set 
to be empty in the shell via "set PATHEXT=", then:
A. CMD.EXE, START.EXE and standard exec do use the default value, which is 
probably hardcoded somewhere (not taken from registry) ... tested on XP only
B. Wine [11] uses a hardcoded ".BAT;.COM;.CMD;.EXE" (I can't say I do see the 
reasons for this particular order)
C. GnuWin32 which utility [12] uses a hardcoded ".COM;.EXE;.BAT;.CMD"

So, in the corner case when the PATHEXT is set empty for whatever reason, we 
have basically the following options:

1. Find some magical way how to get the default value from windows. Any brave 
soul to fight this?

2. Stick with basic NT setting ".COM;.EXE;.BAT;.CMD", and document that it 
doesn't always match the execution behaviour in this case, eg. that .JS file 
would get executed on XP, but won't be found by which()

3. Resemble CMD.EXE/START.EXE and standard windows exec behavior, and hardcode 
the values for different windows versions from NT to W7, and for Wine. This is 
quite simple to do, as windows versions are well documented in 
platform.release()(we don't actually have to call this function, just check 
into which of the 3 intervals the current windows version fits). To do so, I 
only need someone to verify the correct default PATHEXT for W2K and WS 2008, as 
I do not have access to these.

My .02$ for 3, as this is what user expects.

What do you think?

[01]
http://source.winehq.org/source/tools/wine.inf.in#L556
http://archives.free.net.ph/message/20091231.134245.fce4d24a.en.html

[02]
http://technet.microsoft.com/en-us/library/bb490998.aspx
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true
http://technet.microsoft.com/en-us/library/cc772691(WS.10).aspx
(the manual is same for XP and WS 2003 so maybe they just used copy/paste 
without checking.

[11]
http://source.winehq.org/source/programs/cmd/wcmdmain.c#L1019

[12]
http://gnuwin32.sourceforge.net/packages/which.htm
see which-2.20-src.zip / ... / which-2.20-src.diff line 388

--

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-11 Thread Jan Killian

Jan Killian  added the comment:

* hardcoded deafult PATHEXT values for different versions of Windows
  (confirmed the W2K, W2008 values via google)
* code+tests+docs cleanup

Just one question: is there some std proc how to run the test suite on the 
updated stdlib in a working repo?
For now, I just copied the Lib/test/test_shutil.py to a parent Lib/ dir, 
renamed Lib/test temporarily to not collide with a test module, and run python 
test_shutil.py in Lib, but I guess you have some simpler way to do it.

--
Added file: http://bugs.python.org/file17947/shutil_which_82778.patch

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-11 Thread Jan Killian

Changes by Jan Killian :


Added file: http://bugs.python.org/file17948/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-11 Thread Jan Killian

Changes by Jan Killian :


Removed file: http://bugs.python.org/file17948/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-11 Thread Jan Killian

Jan Killian  added the comment:

* updated docs in the patch

@ Éric: Thanks, that works nicely :)

@ Michael: You don't need cygwin to use which and many gnu tools on windows. 
See http://gnuwin32.sourceforge.net/packages.html. After installation you can 
take the ,exe and .dll files in GnuWin32/bin and use them on any pc/network - 
just put them to the path.

@ Tarek: In the docs I used ".. versionadded:: 2.7.1", but this guess needs a 
verification :)

--
Added file: http://bugs.python.org/file17957/shutil_which_82778.patch

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-11 Thread Jan Killian

Changes by Jan Killian :


Removed file: http://bugs.python.org/file17947/shutil_which_82778.patch

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-11 Thread Jan Killian

Changes by Jan Killian :


Added file: http://bugs.python.org/file17958/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-12 Thread Jan Killian

Jan Killian  added the comment:

@ Éric and Antoine: Thanks for the useful hints!

* PATH and PATHEXT are now evaluated when needed, not only on module init. The 
rationale is, that the lib user may change them, eg. to include a directory 
with additional commands.

* the only helper module-level variables left are _windows and _getwinpathext() 

* updated doctest

* updated versionadded in docs to 3.2

--
Added file: http://bugs.python.org/file17962/shutil_which_82778.patch

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-12 Thread Jan Killian

Changes by Jan Killian :


Added file: http://bugs.python.org/file17963/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-14 Thread Jan Killian

Jan Killian  added the comment:

* updated tests

--
Added file: http://bugs.python.org/file18000/shutil_which_82778.patch

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-07-14 Thread Jan Killian

Changes by Jan Killian :


Added file: http://bugs.python.org/file18001/which.py

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2010-08-08 Thread Jan Killian

Jan Killian  added the comment:

Hi Tarek

Will do that on Tusdas. Examples make sense too

Jan

On Sun, Aug 8, 2010 at 11:15 AM, Tarek Ziadé  wrote:
>
> Tarek Ziadé  added the comment:
>
> looks good, minor changes before I commit it
>
> can you:
>
> - remove all old patches in this issue
> - make your code pep8
> - rename the 'file' argument to 'filename'
> - add yourself in ACKS
>
> one or two usage examples in the Doc would be a nice plus
>
> thx
>
> --
>
> ___
> Python tracker 
> <http://bugs.python.org/issue444582>
> ___
>

--

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com