Created by Kevin Locke and last modified

A branch for development work porting Duplicity to run natively on Windows.

Get this branch:
bzr branch lp:~kevinoid/duplicity/windows-port
Only Kevin Locke can upload to this branch. If you are Kevin Locke please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Kevin Locke

Recent revisions

703. By Kevin Locke <email address hidden>

Include updates to GnuPGInterface

These updates are from the current state of a branch of development that
I created to port GnuPGInterface to Windows, fix some bugs, and add
Python 3 support. The branch is available on github at
<http://github.com/kevinoid/py-gnupg>. These changes are taken from
commit 91667c.

I have assurances from the original author of GnuPGInterface that the
changes will be merged into his sources with minimal changes (if any)
once he has time and that it is safe to merge these changes into other
projects that need them without introducing a significant maintenance

Note: This version of GnuPGInterface now uses subprocess rather than
"raw" fork/exec. The threaded waitpid was removed due to threading
issues with subprocess (particularly Issue 1731717). It should be
largely unnecessary as any zombie child processes are reaped when a new
subprocess is started. If the more immediate reaping is required, the
threaded wait can easily be re-added (and less-easily be made thread
safe with subprocess).

Signed-off-by: Kevin Locke <email address hidden>

702. By Kevin Locke <email address hidden>

Unwrap temporary file instances

tempfile.TemporaryFile returns an instance of a wrapper class on
non-POSIX, non-Cygwin systems. Yet the librsync code requires a
standard file object. On Windows, the wrapper is unnecessary since the
file is opened with O_TEMPORARY and is deleted automatically on close.
On other systems the wrapper may be necessary to delete a file, so we
error out (in a way that future developers on those systems should be
able to find and understand...).

Note: This is a bit of a hack and relies on undocumented properties of
the object returned from tempfile.TemporaryFile. However, it avoids
the need to track and delete the temporary file ourselves.

Signed-off-by: Kevin Locke <email address hidden>

701. By Kevin Locke <email address hidden>

Make the manifest format more interoperable

At the cost of losing a bit of information, use the POSIX path
and EOL convention as part of the file format for manifest files.
This way backups created on one platform can be restored on another with
a different path and/or EOL convention.

To accomplish this, change the file mode to binary and convert native
paths to POSIX paths during manifest creation and back during load.

Note: During load the drive specifier for the target directory (if
there is one) is added to the POSIX-converted path. This allows
restoring cross-platform files more easily at the cost of losing a
warning about restoring files to a different drive than the original
backup. If this is unacceptable, the drive could be the first component
of the POSIX path or the cross-platform interoperability could be

Signed-off-by: Kevin Locke <email address hidden>

700. By Kevin Locke <email address hidden>

Prevent Windows paths from being parsed as URLs

Windows paths which begin with a drive specifier are parsed as having a
scheme which is the drive letter. In order to avoid against these paths
being treated as URLs, check if the potential url_string looks like a
Windows path.

Note: The regex is not perfect, since it is possible that the "c" URL
scheme would not require slashes after the protocol. So limit the
checks to Windows platforms where paths are more likely to have this

Signed-off-by: Kevin Locke <email address hidden>

699. By Kevin Locke <email address hidden>

Make file:// URL parsing more portable

Create path.from_url_path utility function which takes the path
component of a file URL and converts it into the native path
representation on the platform.

Note: RFC 1738 specifies that anything after file:// before the next
slash is a hostname (and therefore, implicitly, all paths are absolute).
However, to maintain backwards compatibility, allow for relative paths
to be specified in this manner.

Signed-off-by: Kevin Locke <email address hidden>

698. By Kevin Locke <email address hidden>

Ensure prefix ends with empty path component

WARNING: Functionality change

In order to prevent the given prefix from matching directories which
begin with the last component of prefix, ensure that prefix ends with an
empty path component (causing a tailing slash on POSIX systems).
Otherwise the prefix /foo/b would also include /foo/bar.

Note: If this functionality really was intended, wherever prefix is
removed from a path, the result should not start with a directory
separator (since it would result in a "/" first element in the return
value from path.split_all).

Signed-off-by: Kevin Locke <email address hidden>

697. By Kevin Locke <email address hidden>

Replace path manipulation based on "/"

Make use of path.split_all and os.path.join where paths were manipulated
based on "/"

In selection, change path import to keep path namespace, but alias
path.Path to Path to minimize the diff. The bare uses of split_all
seemed unnecessarily confusing and the other members of path are not
used directly so there is no real need for the * import.

Note: Removed unnecessary use of filter to remove blanks as this is
handled implicitly by os.path.split and therefore by path.split_all.

Note2: Need to be careful that os.path.join must have at least 1
argument, while "/".join() could work on a 0-length array.

Signed-off-by: Kevin Locke <email address hidden>

696. By Kevin Locke <email address hidden>

Create split_all utility function in path

This function is intended to replace the pathstr.split("/") idiom in
many places and provides a convenient way to break an arbitrary path
into its constituent components.

Note: Although it would be possible to split on os.altsep and os.sep
and it would work in many cases, and run a bit faster, it doesn't handle
more complex path systems and is likely to fail in corner cases even in
less complex path systems.

Signed-off-by: Kevin Locke <email address hidden>

695. By Kevin Locke <email address hidden>

Support systems without pwd and/or grp in tarfile

Inside tarfile this case is normally checked by the calling code, but
since uid2uname and gid2gname are called by Path without checking for
pwd and grp (and we want to support this case), remove the assertion
that these modules are defined. When they are not, throw KeyError
indicating the ID could not be mapped.

Signed-off-by: Kevin Locke <email address hidden>

694. By Kevin Locke <email address hidden>

Support more path systems in glob->regex conversion

 - Match against the system path separators, rather than "/"
 - Update duplicity.1 man page to indicate that the metacharacters match
   against the directory separator, rather than "/"

Note: This won't be portable to systems with more complex path systems
(like VMS), but that case is not trivial so it is worth waiting for a
need to arise.

Signed-off-by: Kevin Locke <email address hidden>

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
This branch contains Public information 
Everyone can see this information.