[Python-checkins] r82659 - in python/branches/py3k: Doc/library/os.path.rst Doc/library/os.rst Lib/ntpath.py Lib/tarfile.py Lib/test/support.py Lib/test/symlink_support.py Lib/test/test_glob.py Lib/test/test_httpservers.py Lib/test/test_os.py Lib

Brian Curtin brian.curtin at gmail.com
Fri Jul 9 18:02:10 CEST 2010


On Fri, Jul 9, 2010 at 02:09, Georg Brandl <g.brandl at gmx.net> wrote:

> Am 08.07.2010 23:39, schrieb brian.curtin:
> > Author: brian.curtin
> > Date: Thu Jul  8 23:39:08 2010
> > New Revision: 82659
> >
> > Log:
> > Implement #1578269. Patch by Jason R. Coombs.
> >
> > Added Windows support for os.symlink when run on Windows 6.0 or greater,
> > aka Vista. Previous Windows versions will raise NotImplementedError
> > when trying to symlink.
> >
> > Includes numerous test updates and additions to test_os, including
> > a symlink_support module because of the fact that privilege escalation
> > is required in order to run the tests to ensure that the user is able
> > to create symlinks. By default, accounts do not have the required
> > privilege, so the escalation code will have to be exposed later (or
> > documented on how to do so). I'll be following up with that work next.
> >
> > Note that the tests use ctypes, which was agreed on during the PyCon
> > language summit.
> >
> >
> >
> > Added:
> >    python/branches/py3k/Lib/test/symlink_support.py   (contents, props
> changed)
> > Modified:
> >    python/branches/py3k/Doc/library/os.path.rst
> >    python/branches/py3k/Doc/library/os.rst
> >    python/branches/py3k/Lib/ntpath.py
> >    python/branches/py3k/Lib/tarfile.py
> >    python/branches/py3k/Lib/test/support.py
> >    python/branches/py3k/Lib/test/test_glob.py
> >    python/branches/py3k/Lib/test/test_httpservers.py
> >    python/branches/py3k/Lib/test/test_os.py
> >    python/branches/py3k/Lib/test/test_platform.py
> >    python/branches/py3k/Lib/test/test_posixpath.py
> >    python/branches/py3k/Lib/test/test_shutil.py
> >    python/branches/py3k/Lib/test/test_sys.py
> >    python/branches/py3k/Lib/test/test_sysconfig.py
> >    python/branches/py3k/Lib/test/test_tarfile.py
> >    python/branches/py3k/Misc/ACKS
> >    python/branches/py3k/Misc/NEWS
> >    python/branches/py3k/Modules/posixmodule.c
> >
> > Modified: python/branches/py3k/Doc/library/os.path.rst
> >
> ==============================================================================
> > --- python/branches/py3k/Doc/library/os.path.rst      (original)
> > +++ python/branches/py3k/Doc/library/os.path.rst      Thu Jul  8 23:39:08
> 2010
> > @@ -231,11 +231,15 @@
> >
> >  .. function:: samefile(path1, path2)
> >
> > -   Return ``True`` if both pathname arguments refer to the same file or
> directory
> > -   (as indicated by device number and i-node number). Raise an exception
> if a
> > -   :func:`os.stat` call on either pathname fails.
> > +   Return ``True`` if both pathname arguments refer to the same file or
> directory.
> > +   On Unix, this is determined by the device number and i-node number
> and raises an
> > +   exception if a :func:`os.stat` call on either pathname fails.
> > +
> > +   On Windows, two files are the same if they resolve to the same final
> path
> > +   name using the Windows API call GetFinalPathNameByHandle and this
> function
> > +   raises an exception if handles cannot be obtained to either file.
> >
> > -   Availability: Unix.
> > +   Availability: Windows, Unix.
>
> There is a ".. versionchanged" missing here (and in the other places where
> Windows availability was added).
>
> > Modified: python/branches/py3k/Lib/tarfile.py
> >
> ==============================================================================
> > --- python/branches/py3k/Lib/tarfile.py       (original)
> > +++ python/branches/py3k/Lib/tarfile.py       Thu Jul  8 23:39:08 2010
> > @@ -2273,7 +2273,7 @@
> >            (platform limitation), we try to make a copy of the referenced
> file
> >            instead of a link.
> >          """
> > -        if hasattr(os, "symlink") and hasattr(os, "link"):
> > +        try:
> >              # For systems that support symbolic and hard links.
> >              if tarinfo.issym():
> >                  os.symlink(tarinfo.linkname, targetpath)
> > @@ -2282,7 +2282,15 @@
> >                  if os.path.exists(tarinfo._link_target):
> >                      os.link(tarinfo._link_target, targetpath)
> >                  else:
> > -
>  self._extract_member(self._find_link_target(tarinfo), targetpath)
> > +                    self._extract_mem
> > +        except (AttributeError, NotImplementedError, WindowsError):
> > +            # AttributeError if no os.symlink
> > +            # NotImplementedError if on Windows XP
> > +            # WindowsError (1314) if the required privilege is not held
> by the client
> > +            if tarinfo.issym():
> > +                linkpath = os.path.join(os.path.dirname(tarinfo.name
> ),tarinfo.linkname)
> > +            else:
> > +                linkpath = tarinfo.linkname
> >          else:
> >              try:
> >                  self._extract_member(self._find_link_target(tarinfo),
> targetpath)
>
> Please observe PEP 8 (no overlong lines, space after comma).  (I also see
> overlong lines in other files in the diff.)
>
> > Modified: python/branches/py3k/Misc/ACKS
> >
> ==============================================================================
> > --- python/branches/py3k/Misc/ACKS    (original)
> > +++ python/branches/py3k/Misc/ACKS    Thu Jul  8 23:39:08 2010
> > @@ -154,6 +154,7 @@
> >  Jeffery Collins
> >  Robert Collins
> >  Paul Colomiets
> > +Jason R. Coombs
> >  Geremy Condra
> >  Juan José Conti
> >  Matt Conway
>
> This doesn't seem to be the correct ordering :)
>
> Georg


Changed the docs in r82744, fixed the various line length overflows in
r82745, and re-ordered Jason's name in r82737.

Thanks for taking a look.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-checkins/attachments/20100709/1c38fa5e/attachment.html>


More information about the Python-checkins mailing list