mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
deploy-ng: Do not create/copy empty directories
This includes any directories that have all contents ignored.
This commit is contained in:
parent
99c3e16dff
commit
f081a8f052
@ -242,19 +242,30 @@ class build_apps(distutils.core.Command):
|
||||
ignore_copy_list += self.exclude_paths
|
||||
ignore_copy_list = [p3d.GlobPattern(i) for i in ignore_copy_list]
|
||||
|
||||
def copy_file(src, dst):
|
||||
src = os.path.normpath(src)
|
||||
dst = os.path.normpath(dst)
|
||||
|
||||
def check_pattern(src):
|
||||
for pattern in ignore_copy_list:
|
||||
# Normalize file paths across platforms
|
||||
path = p3d.Filename.from_os_specific(src).get_fullpath()
|
||||
#print("check ignore:", pattern, src, pattern.matches(path))
|
||||
if pattern.matches(path):
|
||||
return True
|
||||
return False
|
||||
|
||||
def dir_has_files(directory):
|
||||
files = [
|
||||
i for i in os.listdir(directory)
|
||||
if not check_pattern(os.path.join(directory, i))
|
||||
]
|
||||
return bool(files)
|
||||
|
||||
def copy_file(src, dst):
|
||||
src = os.path.normpath(src)
|
||||
dst = os.path.normpath(dst)
|
||||
|
||||
if check_pattern(src):
|
||||
print("skipping file", src)
|
||||
return
|
||||
|
||||
|
||||
dst_dir = os.path.dirname(dst)
|
||||
if not os.path.exists(dst_dir):
|
||||
distutils.dir_util.mkpath(dst_dir)
|
||||
@ -278,7 +289,7 @@ class build_apps(distutils.core.Command):
|
||||
d = os.path.join(dst, item)
|
||||
if os.path.isfile(s):
|
||||
copy_file(s, d)
|
||||
else:
|
||||
elif dir_has_files(s):
|
||||
copy_dir(s, d)
|
||||
|
||||
for path in self.copy_paths:
|
||||
|
Loading…
x
Reference in New Issue
Block a user