INNER CODE UNIT · Python
create_distribution
skarndev/umodel_tools · build.py:37
def create_distribution(dist_path: t.Optional[str]):
if dist_path:
cwd = os.getcwd()
try:
print_info(f'\nCreating addon distribution in \"{dist_path}\" ...')
os.makedirs(dist_path, exist_ok=True)
shutil.copytree(os.path.dirname(os.path.abspath(__file__)), dist_path, dirs_exist_ok=True)
print(os.path.dirname(os.path.abspath(__file__)), dist_path)
os.chdir(dist_path)
yield None
# remove junk
for root, dirs, _ in os.walk(dist_path):
for subdir in dirs:
if subdir.startswith('.') or subdir == '__pycache__':
shutil.rmtree(os.path.join(root, subdir), ignore_errors=True)