DRTVWR-447: Introduce LLManifest.process_either().

process_directory() and process_file() are reached both from the top-level
caller (try_path(), a local function within LLManifest.path()) and recursively
from process_directory(). Both places tested os.path.isdir(source), and if so
called process_directory(), else process_file(). Both places were wrong, as it
turns out.

os.path.isdir(symlink_to_directory) returns True. That meant that despite
explicit logic in ccopymumble() to recreate symlinks in the destination area,
we were consistently recopying the contents of symlinked directories.

The downside to this -- in addition to inflating the size of the installer! --
is that macOS is very particular about the structure of a Framework bundle. It
*must* include a Versions/Current symlink identifying which of the other
Versions subdirectories is, in fact, current. If Current is itself a
subdirectory, codesign can't figure out how to sign the framework, and fails.

The logic for deciding between process_directory() and process_file() must
explicitly check for os.path.islink(source). Rather than replicating that
change in both places, introduce process_either() which decides how to forward
the call, and call it both from try_path() and from process_directory().
meow-7.2.2
Nat Goodspeed 2018-10-22 19:59:07 -04:00
parent f55d3071e1
commit 279073dbb3
1 changed files with 10 additions and 9 deletions

View File

@ -615,6 +615,14 @@ class LLManifest(object):
# *TODO is this gonna be useful?
print "Cleaning up " + c
def process_either(self, src, dst):
# If it's a real directory, recurse through it --
# but not a symlink! Handle those like files.
if os.path.isdir(src) and not os.path.islink(src):
return self.process_directory(src, dst)
else:
return self.process_file(src, dst)
def process_file(self, src, dst):
if self.includes(src, dst):
for action in self.actions:
@ -641,10 +649,7 @@ class LLManifest(object):
for name in names:
srcname = os.path.join(src, name)
dstname = os.path.join(dst, name)
if os.path.isdir(srcname):
count += self.process_directory(srcname, dstname)
else:
count += self.process_file(srcname, dstname)
count += self.process_either(srcname, dstname)
return count
def includes(self, src, dst):
@ -816,11 +821,7 @@ class LLManifest(object):
# if we're specifying a single path (not a glob),
# we should error out if it doesn't exist
self.check_file_exists(src)
# if it's a directory, recurse through it
if os.path.isdir(src):
count += self.process_directory(src, dst)
else:
count += self.process_file(src, dst)
count += self.process_either(src, dst)
return count
try_prefixes = [self.get_src_prefix(), self.get_artwork_prefix(), self.get_build_prefix()]