Commit Graph

118 Commits

Author SHA1 Message Date
Brett Cannon dfa5d95613 Remove tabs introduced in last commit. 2004-07-11 19:16:21 +00:00
Brett Cannon f50299c378 posixpath.realpath() now detects symlink loops and returns the path just before
the loop starts.

Closes bug #930024.  Thanks AM Kuchling.
2004-07-10 22:55:15 +00:00
Martin v. Löwis bdec50f027 Feature request #935915: Add os.path.devnull. 2004-06-08 08:29:33 +00:00
Fred Drake 1cd6e4dc38 fix various descriptions of "ctime"
(closes SF patch #870287)
2004-05-12 03:51:40 +00:00
Raymond Hettinger 74bb7f03b1 SF Patch 681780: Faster commonprefix (OS independent)
Improved based on discussions at:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252177
http://groups.google.com/groups?th=fc7b54f11af6b24e&seekm=bss2so$om$00$1@news.t-online.com
2003-12-31 22:44:29 +00:00
Raymond Hettinger cc523fc53d SF patch #834015: Remove imports of unused modules
(Contributed by George Yoshida.)
2003-11-02 09:47:05 +00:00
Just van Rossum 2d4e988c35 back out the darwin supports_unicode_filenames patch; it causes deep problems with the tests 2003-07-17 15:11:49 +00:00
Just van Rossum c4bf893952 [ 767645 ] correctly set the os.path.supports_unicode_filenames flag for OSX 2003-07-11 07:36:49 +00:00
Walter Dörwald a9da5ae07a Use find() instead of looping over the string in expanduser().
From SF patch #757058.
2003-06-19 10:21:14 +00:00
Walter Dörwald 77cdeaff55 Modernize Lib/posixpath.py: Use startswith(), endswith(), rstrip(),
struct_passwd attributes and +=.

From SF patch #755245.
2003-06-17 13:13:40 +00:00
Skip Montanaro 117910dc44 Migrate definitions of several platform-dependent path-related variables
into the relevant path modules.  See patch #686397.
2003-02-14 19:35:31 +00:00
Neal Norwitz 61cdac6d3d Fix SF #659228, 'realpath' function missing from os.path
Also added realpath = abspath for os2emx, similar to windows/mac
which also don't really implement realpath.

Backport candidate, I think?
2003-01-03 18:01:57 +00:00
Martin v. Löwis 96a60e4af5 Patch #658927: Add getctime to os.path.
Document that getatime and getmtime may return floats.
2002-12-31 13:11:54 +00:00
Martin v. Löwis de3337913f Patch #536661: Improve performance of splitext. Add test_macpath. 2002-12-12 20:30:20 +00:00
Tim Peters 230a60c6ec Whitespace normalization. 2002-11-09 05:08:07 +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
Neal Norwitz 609ba81cdb SF # 555779, import user doesn't work with CGIs 2002-09-05 21:08:25 +00:00
Neal Norwitz ec7cf1382b Remove another reference to stat.ST_MODE 2002-06-06 18:16:14 +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
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
Tim Peters b64bec3ec0 Whitespace normalization. 2001-09-18 02:26:39 +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
Guido van Rossum a490d5856d In walk(), don't die when os.lstat() raises os.error, e.g. because a
file was deleted by a previous call to the visitor function.

This used to be the behavior in 1.5.2 and before, but a patch to avoid
making two stat() calls accidentally broke this in 2.0.

Moshe, this would be a good one for 2.0.1 too!
2001-04-16 18:12:04 +00:00
Skip Montanaro c62c81e013 __all__ for several more modules 2001-02-12 02:00:42 +00:00
Tim Peters 658cba6706 Whitespace normalization. 2001-02-09 20:06:00 +00:00
Marc-André Lemburg bf222c9f12 Fixed posixpath.normpath() to respect two leading slashes, but
turn three or more into a single slash. (This is in sync with POSIX
susv2 according to Fredrik.)
2001-01-29 11:29:44 +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 c0ab93ef6f Minor style nits. 2000-09-28 16:22:52 +00:00
Fred Drake 22fb839f0c Remove imports of string when string methods will do. 2000-09-28 15:04:39 +00:00
Skip Montanaro 623583165e revert semantics of commonprefix to work character-by-character 2000-08-22 13:01:53 +00:00
Skip Montanaro 018dfae246 added rewritten normpath from Moshe Zadka that does the right thing with
paths containing ..
2000-07-19 17:09:51 +00:00
Skip Montanaro a924bb1ad2 split and join on "/" in commonprefix 2000-07-16 16:52:45 +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
Jeremy Hylton a05e293a21 typos fixed by Rob Hooft 2000-06-28 14:48:01 +00:00
Guido van Rossum a9b2b4be26 Remove some redundant logic from walk() -- there's no need to check
for "." and "..", since listdir() no longer returns those.
2000-02-29 13:31:16 +00:00
Guido van Rossum 84a74595f7 Patch by Gerrit Holl to avoid doing two stat() calls in a row in walk(). 2000-02-28 14:27:07 +00:00
Guido van Rossum 9811861e3c Mark Favas discovered this: getatime() accidentally returned the MTIME!
This fixes PR#211.
2000-02-24 02:26:51 +00:00
Guido van Rossum 54f22ed30b More trivial comment -> docstring transformations by Ka-Ping Yee,
who writes:

Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.

I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.

The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings.  Hope this is
okay.
2000-02-04 15:10:34 +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 e294cf620a Add abspath() 1999-01-29 18:05:18 +00:00
Guido van Rossum a063303693 Patch suggested by Perry Stoll -- os.path.normpath(".//x") returned
"/x", should return "x".
1998-09-08 22:28:06 +00:00
Guido van Rossum 2bc1f8f07e Added getsize(), getmtime(), getatime() 1998-07-24 20:49:26 +00:00
Guido van Rossum 346f7af8ff Added doc strings and reindented according to new standard, without tabs.
(Like ntpath.py, this was contributed by "Charles G. Waldman" <cgw@pgt.com>)
1997-12-05 19:04:51 +00:00
Guido van Rossum 9694fcab53 Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
Barry Warsaw 384d249006 join(): join one or more path components 1997-02-18 21:53:25 +00:00
Guido van Rossum 422869a75c Correct description of splitext(). 1996-08-20 20:24:17 +00:00
Guido van Rossum d3876d33d3 Renamed all occurrences of posix to os. 1996-07-23 03:47:28 +00:00
Guido van Rossum bbb4e10e91 Subtlety: ~root/a should expand to /a, not //a. Everything else unchanged. 1996-04-02 22:30:03 +00:00
Guido van Rossum a89b1bade5 rationalized os.path.split() so split "/a/" yields "/a", "" 1995-09-01 20:32:21 +00:00
Guido van Rossum 221df24940 add splitdrive() 1995-08-07 20:17:55 +00:00
Sjoerd Mullender 4359860517 Let extensions start at the last period after the last slash in the
name.
1994-12-14 15:29:17 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum df5638662d * posixpath.py: Fix border cases in normpath ('/foo/..' should return '/')
* ftplib.py: made cwd() use 'CDUP' when dirname is '..'
* FL.py: added new constant FL_PLACE_FULLSCREEN
1993-07-06 15:19:36 +00:00
Guido van Rossum c629d34c4f * change default line numbers for 'list' in pdb.py
* changed eval() into getattr() in cmd.py
* added dirname(), basename() and (dummy) normath() to macpath.py
* renamed nntp.py to nntplib.py
* Made string.index() compatible with strop.index()
* Make string.atoi('') raise string.atoi_error rather than ValueError
* Added dirname() and normpath() to posixpath.
1992-11-05 10:43:02 +00:00
Guido van Rossum 4732ccf642 Added emacs.py (for misc/py-connect.el).
posixpath.py: added undocumented expanndvars() (expands $VAR in string).
1992-08-09 13:54:50 +00:00
Guido van Rossum 509d24aac3 fix a typo in samestat() (ST_DEV, not STD_DEV);
rewrite ismount() to compare stats of path and path/..
1992-05-06 11:36:49 +00:00
Guido van Rossum 2684738d2f Renamed to posixpath; changed def'n of split(). 1992-03-31 18:54:35 +00:00
Guido van Rossum 7ac4878773 Make nicer comments.
Added expanduser() and normcase() and isabs() and isfile().
1992-01-14 18:29:32 +00:00
Guido van Rossum bdfcfccbe5 New == syntax 1992-01-01 19:35:13 +00:00
Guido van Rossum 470e7617a9 Use AttributeError. 1991-12-26 13:05:43 +00:00
Guido van Rossum d3778f9f60 Added samefile() function. 1991-11-12 15:37:40 +00:00
Guido van Rossum 4d0fdc34d1 path.cat --> join
Added splitext
1991-08-16 13:27:58 +00:00
Guido van Rossum 40d9304d66 Use 'stat' module instead of hardcoding information from <sys/stat.h>. 1990-10-21 16:17:34 +00:00
Guido van Rossum c636014c43 Initial revision 1990-10-13 19:23:40 +00:00