15 Commits

Author SHA1 Message Date
Sybren A. Stüvel
e4bf2e8e35 Improved path handling
This commit fixes a bunch of issues at the same time, as they are all
related to path handling:

- `pathlib.Path.resolve()` or `.absolute()` are replaced by
  `bpathlib.make_absolute()`. The latter does NOT follow symlinks and does
  NOT network mounts from a drive letter to UNC notation. This also has
  advantages on non-Windows sytems, as it allows BAT-packing a directory
  structure with symlinked files (such as a Shaman checkout).
- Better handling of drive letters, and of paths that cross drive
  boundaries.
- Better testing of Windows-specific cases when running the tests on
  Windows, and of POSIX-specific cases on other platforms.

Thanks to @wisaac for starting this patch in D6676.

Thanks to @jbakker for pointing out the drive letter issue. This fixes
T70655.
2020-03-17 17:15:19 +01:00
Sybren A. Stüvel
03fb4da583 Convert target path from Path to str & PurePath
The target path is just read as string from the CLI now, to allow more
complex targets (such as URLs) that don't directly map to a path.

The Packer subclass now handles the conversion from that string to a
`pathlib.PurePath`, and specific subclasses & transfer classes can convert
those to a `pathlib.Path` to perform actual filesystem operations when
necessary.
2019-02-26 16:35:08 +01:00
Sybren A. Stüvel
d81fe590db BlendPath: don't use os.path.join() for slash notations
The BlendPath should just use forward slashes, and not be depending on the
current platform.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
0e392f27c9 BlendPath.__repr__ implemented 2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
19216cb12e BlendPath.as_path() now refuses to convert blendfile-relative paths
When a path starts with b'//' it will not be converted to a PurePath, as
the handling of such filenames is platform dependent (Windows handles those
weirdly, like appending a slash to any path).
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
5635895d0c Attempt at making BAT work on Windows
All BlendPath instances will use forward slashes, and there should be
more use of PurePosixPath instead of Path.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
38b3e2b55c Fixed a whole bunch of MyPy errors
New release of mypy picks up more.
2018-07-10 16:02:14 +02:00
Sybren A. Stüvel
53e22a4a2f Added GPL comment blocks with proper attibution. 2018-03-16 13:25:20 +01:00
Sybren A. Stüvel
d984870155 Don't repeat superclass name 2018-03-09 09:59:54 +01:00
Sybren A. Stüvel
e9ee5b69ec Disallow BlendPath(str) 2018-03-08 14:18:07 +01:00
Sybren A. Stüvel
71dd5bc11b Path rewriting when packing.
Doesn't work with sequences, nor with split dirname/basename fields.
2018-03-06 16:06:36 +01:00
Sybren A. Stüvel
677d388a15 Convert BlendPath to pathlib.Path using local filesystem encoding
UTF-8 is tried first, and if that fails the local filesystem encoding is
used.
2018-03-02 13:42:49 +01:00
Sybren A. Stüvel
86af05e823 Added recursion into library blend files. 2018-02-28 12:42:27 +01:00
Sybren A. Stüvel
6b9c0a3f95 Support slash notation for BlendPath
This mimicks the slash notation of pathlib.Path
2018-02-27 17:29:44 +01:00
Sybren A. Stüvel
15cd74cda4 Start of dependency tracer work. 2018-02-26 18:16:15 +01:00