Tim Peters
26bc25a6c4
Don't try to access sys.getwindowsversion unless it exists (ntpath is
...
imported on systems other than Windows, and in particular is imported
by test___all__; the compile farm reported that all Linux tests failed
due to this; isn't anyone in PythonDevLand running CVS on Linux?!).
2002-10-09 07:56:04 +00:00
Mark Hammond
8696ebcd28
Add os.path.supports_unicode_filenames for all platforms,
...
sys.getwindowsversion() on Windows (new enahanced Tim-proof <wink>
version), and fix test_pep277.py in a few minor ways.
Including doc and NEWS entries.
2002-10-08 02:44:31 +00:00
Raymond Hettinger
32200aeac6
Replaced obsolete stat module constants with equivalent attributes
2002-06-01 19:51:15 +00:00
Raymond Hettinger
54f0222547
SF 563203. Replaced 'has_key()' with 'in'.
2002-06-01 14:18:47 +00:00
Guido van Rossum
8ca162f417
Partial introduction of bools where appropriate.
2002-04-07 06:36:23 +00:00
Tim Peters
bc0e910826
Convert a pile of obvious "yes/no" functions to return bool.
2002-04-04 22:55:58 +00:00
Mark Hammond
f717f0500c
Allow abspath to still do something sensisble if the nt module can not be imported.
2002-01-17 00:44:26 +00:00
Tim Peters
6a3e5f14a6
SF bug 478425: Change in os.path.join (ntpath.py)
...
ntpath.join('a', '') was producing 'a' instead of 'a\\' as in 2.1.
Impossible to guess what was ever *intended*, but since split('a\\')
produces ('a', ''), I think it's best if join('a', '') gives 'a\\' back.
2001-11-05 21:25:02 +00:00
Tim Peters
cf5e6a4a5d
SF bug [ #469732 ] os.path.walk docstring inconsistent.
...
We have 5 implementations of walk(), and 5 different docstrings. Combined
'em. Let's see how long it takes before they're all different again!
2001-10-10 04:16:20 +00:00
Guido van Rossum
83eeef4b06
SF patch #461781 by Chris Lawrence: os.path.realpath - Resolve symlinks:
...
Once upon a time, I put together a little function
that tries to find the canonical filename for a given
pathname on POSIX. I've finally gotten around to
turning it into a proper patch with documentation.
On non-POSIX, I made it an alias for 'abspath', as
that's the behavior on POSIX when no symlinks are
encountered in the path.
Example:
>>> os.path.realpath('/usr/bin/X11/X')
'/usr/X11R6/bin/X'
2001-09-17 15:16:09 +00:00
Tim Peters
54a14a373e
SF bug #456621 : normpath on Win32 not collapsing c:\\..
...
I actually rewrote normpath quite a bit: it had no test cases, and as
soon as I starting writing some I found several cases that didn't make
sense.
2001-08-30 22:05:26 +00:00
Tim Peters
33dc0a1705
One more crack at join(): stop trying to pretend this isn't a mass of
...
special cases. test_pkg works again on Windows.
2001-07-27 08:09:54 +00:00
Tim Peters
4223f89edd
Change ntpath.join() so that join("d:/", "/whatever") returns
...
d:/whatever instead of /whatever. While I'm afraid changing isabs()
to be *consistent* with this would break lots of code, it makes
best sense for join() to do it this way. Thanks to Alex Martelli for
pushing back on this one!
2001-07-26 21:54:37 +00:00
Fred Drake
79e75e1916
Use string.ascii_letters instead of string.letters (SF bug #226706 ).
2001-07-20 19:05:50 +00:00
Tim Peters
1bdd0f2559
SF bug #44271 : os.path.expanduser problem w/o HOME set.
...
This is a Windows-specific glitch that's really due to that, e.g.,
ntpath.join("c:", "/abc") returned "/abc" instead of "c:/abc". Made
join smarter.
Bugfix candidate.
2001-07-19 17:18:18 +00:00
Fred Drake
da05e977f3
abspath(): Fix inconsistent indentation.
2001-05-15 15:23:01 +00:00
Mark Hammond
ef8b654bbe
Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465.
2001-05-13 08:04:26 +00:00
Skip Montanaro
269b83bc05
added several more __all__ lists
2001-02-06 01:07:02 +00:00
Tim Peters
2344fae6d0
Whitespace normalization.
2001-01-15 00:50:52 +00:00
Fred Drake
8152d32375
Update the code to better reflect recommended style:
...
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:20:45 +00:00
Fred Drake
b4e460ac4b
Avoid import of string module; it is only needed for expandvars().
...
Never assume that os.sep is for the module-specific platform; use the
right separator character directly.
Fix some minor style consistency nits.
2000-09-28 16:25:20 +00:00
Tim Peters
0eeba5b24b
Part of SF patch 101481: on Windows, os.path.join("a:", "b") should yield
...
"a:b", not "a:/b". Similar change was made to posixmodule.c earlier.
2000-09-19 20:39:32 +00:00
Skip Montanaro
623583165e
revert semantics of commonprefix to work character-by-character
2000-08-22 13:01:53 +00:00
Mark Hammond
647d2fe145
Fix for Bug #110673 : os.abspatth() now always returns os.getcwd() on Windows, if an empty path is specified. It previously did not if an empty path was delegated to win32api.GetFullPathName())
2000-08-14 06:20:32 +00:00
Skip Montanaro
1d3dd74574
* split on / or \
...
* case insensitive comparison
2000-07-17 03:06:58 +00:00
Skip Montanaro
4d5d5bf5ae
forgot to change copy.copy(m) to m[:]
2000-07-13 01:01:03 +00:00
Skip Montanaro
97bc98aea7
fixed semantics of commonprefix to work by path elements instead of
...
characters.
2000-07-12 16:55:57 +00:00
Fred Drake
162bd855a6
Fix bug #345 reported by David Bolen <db3l@fitlinxx.com>:
...
getatime() returned the mtime instead of the atime.
Similar to an old bug in posixpath.py.
2000-07-01 06:36:51 +00:00
Fred Drake
ef0b5dd080
Typo in a comment: "wheter" --> "whether"
2000-02-17 17:30:40 +00:00
Guido van Rossum
823e91c767
Optimize abspath() slightly for the case that win32api can't be
...
imported; in that case, abspath is replaced by a fallback version.
2000-02-02 16:54:39 +00:00
Guido van Rossum
6dfc792fea
In abspath(), always use normpath(), even when win32api is available
...
(and even when it fails). This avoids the problem where a trailing
separator is not removed when win32api.GetFullPathName() is used.
1999-11-30 15:00:00 +00:00
Guido van Rossum
f618a48d11
Correct typo in walk.__doc__ reported by Francois Pinard.
1999-11-02 13:29:08 +00:00
Guido van Rossum
f3c695c467
Withdraw the UNC support from splitdrive(). Instead, a new function
...
splitunc() parses UNC paths. The contributor of the UNC parsing in
splitdrive() doesn't like it, but I haven't heard a good reason to
keep it, and it causes some problems. (I think there's a
philosophical problem -- to me, the split*() functions are purely
syntactical, and the fact that \\foo is not a valid path doesn't mean
that it shouldn't be considered an absolute path.)
Also (quite separately, but strangely related to the philosophical
issue above) fix abspath() so that if win32api exists, it doesn't fail
when the path doesn't actually exist -- if GetFullPathName() fails,
fall back on the old strategy (join with getcwd() if neccessary, and
then use normpath()).
1999-04-06 19:32:19 +00:00
Guido van Rossum
8f0fa9e47f
New code for split() by Tim Peters, behaves more like posixpath.split().
1999-03-19 21:05:12 +00:00
Guido van Rossum
534972bce2
New splitdrive() that knows about UNC paths (e.g., network paths like
...
\\host\mountpoint\dir\file). By Larry Hastings.
Also cleaned up some docstrings.
1999-02-03 17:20:50 +00:00
Guido van Rossum
9787bea4cd
Use win32api.GetFullPathName(path) if it exists to implement abspath().
1999-01-29 22:30:41 +00:00
Guido van Rossum
e294cf620a
Add abspath()
1999-01-29 18:05:18 +00:00
Guido van Rossum
2bc1f8f07e
Added getsize(), getmtime(), getatime()
1998-07-24 20:49:26 +00:00
Guido van Rossum
b485224d82
REMOVE samefile(), sameopenfile(), samestat() -- these cannot be made
...
to work reliably (at least I wouldn't know how).
1998-05-02 00:47:09 +00:00
Guido van Rossum
16a0bc278e
(1) Change normpath() to *not* also call normcase().
...
(2) Fix normcase() to use string.lower() and string.replace() -- it
turns out that the table constructed for translate() didn't work in
locales that have a different number of lowercase and uppercase
letters.
1998-02-18 13:48:31 +00:00
Guido van Rossum
ca99c2ce75
Fix to ismount(). Can't remember who told me this.
1998-01-19 22:25:59 +00:00
Guido van Rossum
15e22e1c3a
Added doc strings and reindented according to new standard, without tabs.
1997-12-05 19:03:01 +00:00
Guido van Rossum
e2ad88c202
Rewrite normcase() using string.translate...
1997-08-12 14:46:58 +00:00
Guido van Rossum
77e1db3b34
Support $HOME in expanduser().
...
(Who'd thought that *anyone* would be interested in writing ~/foo on NT :-)
1997-06-02 23:11:57 +00:00
Barry Warsaw
19302de7a0
join(): Wax the incorrect leading comment
1997-02-18 22:06:21 +00:00
Barry Warsaw
384d249006
join(): join one or more path components
1997-02-18 21:53:25 +00:00
Guido van Rossum
73e122f563
Fix splitext() to go up to the last dot, not the first.
1997-01-22 00:17:26 +00:00
Guido van Rossum
3df7b5a546
Don't do truncation to 8+3 format -- this is used on NT file systems!
1996-08-26 16:35:26 +00:00
Guido van Rossum
0523d63a5c
Don't use 'false'; use '0'.
1996-08-08 18:32:15 +00:00
Guido van Rossum
99bf06b2fc
same thing as for dospath, plus HOMEDRIVE/HOMEPATH support
1995-08-10 19:34:50 +00:00
Guido van Rossum
555915a90b
Added ntpath.py (for os.py when used with Windows NT)
1994-02-24 11:32:59 +00:00