Re: [Python-Dev] Special file "nul" in Windows and os.stat

2007-10-30 Thread Chris Mellon
On Oct 24, 2007 11:05 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > So, the question is what we should do?:
>
> Before this question can be answered, I think we need to fully
> understand what precisely is happening in 2.4, and what precisely
> is happening in 2.5.
>
> AFAICT, it is *not* the case that Python 2.4 (indirectly) has
> hard-coded the names CON, PRN, NUL etc. in the C library. Instead,
> Python 2.4 *also* relies on kernel32 functions to determine that
> these files "exist".
>
> My question now is what specific kernel32 functions Python 2.4
> calls to determine that NUL is a file; before that question
> is sufficiently answered, I don't think any action should be
> taken.
>


os.path.exist() in win32 just calls os.stat() and decides it doesn't
exist if an error is returned. os.stat() uses the vcrt stat()in 2.4,
but 2.5 implements it directly in terms of win32 api to deal with
limitations in the vcrt implementation.

The hand-rolled stat uses GetFileAttributesEx, which returns 0 for the
special filenames, with an error code of "The parameter is incorrect"
(87), which is why os.path.exists() claims it doesn't exist.

Interestingly, plain old GetFileAttributes() works, and returns
FILE_ATTRIBUTE_ARCHIVE for them.
___
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] Special file "nul" in Windows and os.stat

2007-10-31 Thread Chris Mellon
On Oct 30, 2007 4:10 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> >> My question now is what specific kernel32 functions Python 2.4
> >> calls to determine that NUL is a file; before that question
> >> is sufficiently answered, I don't think any action should be
> >> taken.
> >>
> >
> > os.path.exist() in win32 just calls os.stat() and decides it doesn't
> > exist if an error is returned. os.stat() uses the vcrt stat()in 2.4,
> > but 2.5 implements it directly in terms of win32 api to deal with
> > limitations in the vcrt implementation.
>
> That doesn't really answer the question, though - you merely state
> that Python 2.4 calls the CRT, but then my question is still what
> kernel32 functions are called to have stat on NUL succeed.
>

I'm not 100% (it calls it through a function pointer and I'm not sure
I tracked it down correctly), but I think it calls it through the C
stat() function. In other words, it doesn't use any kernel32 functions
directly, it calls the stat() that's exported from the MSVCRT.

> > Interestingly, plain old GetFileAttributes() works, and returns
> > FILE_ATTRIBUTE_ARCHIVE for them.
>
> What about the other attributes (like modification time, size, etc)?
>

GetFileAttributes() doesn't return those, just the FAT filesystem
attributes. GetFileSize and GetFileTime fail.

> Regards,
> Martin
>
___
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] Build Notes for building trunk with Visual Studio 2008 Express Edition

2007-11-26 Thread Chris Mellon
On Nov 23, 2007 8:53 AM, Paul Moore <[EMAIL PROTECTED]> wrote:
> I have just built the current trunk version of Python on Windows,
> using the new PCBuild9 directory, and Visual Studio 2008 Express
> Edition.
>
> Everything went extremely well. I include below my notes on what I
> did, for reference. To be honest, there's nothing in here that really
> warrants a change to the readme.txt - to all intents and purposes, the
> process "just works".
>
> OK, here are my notes:
>
> Install Visual C++ 2008 Express Edition. Only select Silverlight from
> the options (no documentation or SQL Server - Silverlight probably
> isn't actually needed either).
> I already had the Platform SDK installed, but did nothing to tell VS
> about it, or to integrate it. I doubt this is relevant.
>
> I am using Python trunk at revision 59132. (But I hit an issue fixed
> in 59136, so better to use that).
>
> Start VC.
> Open project PCBuild9\pcbuild.sln
> Message "Solution Folders are not supported in this version of Visual
> Studio. Solution folder 'Solution Items' will be displayed as
> unavailable." Select OK.
>
> Select the release build (Build > Configuration Manager)
>
> Right click pythoncore > Build
>   make_buildinfo - succeeded 1 warning (unlink vs _unlink)
>   make_versioninfo - succeeded
>   pythoncore - I hit an error in ast.c so I needed to svn up (to
> 59136). Succeeded.
>
> Right click python > Build. Succeeded.
> Right click pythonw > Build. Succeeded.
> Right click _socket > Build. Succeeded.
> Right click _testcapi > Build. Succeeded.
> Right click pyexpat > Build. Succeeded.
> Right click select > Build. Succeeded.
> Right click unicodedata > Build. Succeeded.
> Right click winsound > Build. Succeeded.
>
> At this point, we have finished the modules documented as "build out
> of the box" in PCBuild9\readme.txt.
>
> The modules _tkinter, bz2, _bsddb, _sqlite3, _ssl are documented as
> having dependencies. See below.
>
> Modules _ctypes, _ctypes_test, _elementtree, _msi, w9xpopen are not
> mentioned in readme.txt. They all build without error.
>
> bz2
> ---
>
> The include dir is a macro, and I can't work out how to override the
> default (which is bzip2-1.0.3). So I stuck to 1.0.3 and exported it
> from Python svn, as per the instructions.
>
> Built OK.
>
> _sqlite3
> 
>
> Again, couldn't work out how to change the macro, so I stuck with the
> external from svn (sqlite-source-3.3.4).
>
> The pre-link step failed with an error about not finding TCL. I edited
> the prelink step to include a /DNO_TCL flag on the cl command. There
> may be a better approach - I don't know if not having TCL is an issue
> for Python's use of sqlite.
>
> _tkinter and _bsddb
> ---
>
> The instructions suggest using VS 2003 to build the dependencies. I
> don't have VS 2003 and don't have the time at the moment to
> investigate further.
>
> _ssl
> 
>
> Christian has been making changes to allow this to build without Perl,
> so I gave it a try. I used openssl 0.9.8g, which I extracted to the
> build directory (I noticed afterwards that this is the same version as
> in Python svn, so I could have used the svn external!)
>
> I needed to download nasm (nasm.sf.net) version 2.00rc1, and rename
> nasm.exe to nasmw.exe and put it on my PATH.
>
> Build succeeded, no issues.
>
> Tests
> -
>
> Running the tests, all succeed except test_tcl and test_bsddb, which
> are because I didn't build those two extensions, and test_os. The
> test_os failure is just because it looks for C:\pagefile.sys and my
> pagefile is on D:\.
>
> (There's also a problem with test_socket_ssl hanging, but this is
> present in the standard 2.6 snapshot build. I've raised a separate bug
> report for this).
>


I was able to build both 2.6 and py3k (trunk checkouts, revision 59136
and 59130 respectively) out of the box, except for openssl and tcl,
which I didn't try to install. The external libraries I placed as
sibling directories to the python source root dir, just as with the
previous PCBuild instructions. I didn't need to build in any specific
order, "Build solution" correctly resolved dependencies. I got the
alert box about solution folders but it didn't harm anything.


If anyone is curious, I ran pybench for both 2.6 and 3k build against
VS 2003 and VS 2008. This is using the out of the box settings, and no
PGO for 2008 (Express version doesn't have it). MSVC 9 was slightly
faster for 2.6, but somewhat slower for py3k. I'm not sure how
relevant that is, but (surprisingly to me) it's not an automatic speed
win over MSVC 7.1. The results of my pybench runs available here:

http://code.google.com/p/wxpsvg/wiki/PyBenchRuns
___
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] [Python-3000] Code freeze?

2008-02-28 Thread Chris Mellon
On Thu, Feb 28, 2008 at 1:49 PM, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Hey Barry!
>
>  When are you planing to freeze the code of the trunk and branches/py3k
>  for the upcoming alpha releases? I'll merge the last modifications from
>  2.6 to 3.0 in a couple of minutes. All tests on Linux are looking good,
>  except for the two profile tests on 3.0. I'm going to test Windows later.
>

Would a call for third-party module maintainer updates be justified?
pysqlite in particular has advanced a couple versions since 2.5, and
it'd be nice if the latest made it into 2.6.
___
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