Skip to content

Commit 1475ae7

Browse files
authored
Merge pull request #23 from sommersoft/folder_rename
Fix Zip Top-Level Folder Name
2 parents ce7dc58 + b380837 commit 1475ae7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

circuitpython_build_tools/scripts/build_bundles.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ def add_file(bundle, src_file, zip_name):
5151
def build_bundle(libs, bundle_version, output_filename,
5252
build_tools_version="devel", mpy_cross=None, example_bundle=False):
5353
build_dir = "build-" + os.path.basename(output_filename)
54-
build_lib_dir = os.path.join(build_dir, build_dir.replace(".zip", ""), "lib")
55-
build_example_dir = os.path.join(build_dir, build_dir.replace(".zip", ""), "examples")
54+
top_folder = os.path.basename(output_filename).replace(".zip", "")
55+
build_lib_dir = os.path.join(build_dir, top_folder, "lib")
56+
build_example_dir = os.path.join(build_dir, top_folder, "examples")
5657
if os.path.isdir(build_dir):
5758
print("Deleting existing build.")
5859
shutil.rmtree(build_dir)
@@ -78,7 +79,7 @@ def build_bundle(libs, bundle_version, output_filename,
7879
print()
7980
print("Generating VERSIONS")
8081
if multiple_libs:
81-
with open(os.path.join(build_dir, build_dir.replace(".zip", ""), "VERSIONS.txt"), "w") as f:
82+
with open(os.path.join(build_dir, top_folder, "VERSIONS.txt"), "w") as f:
8283
f.write(bundle_version + "\r\n")
8384
versions = subprocess.run('git submodule foreach \"git remote get-url origin && git describe --tags\"', shell=True, stdout=subprocess.PIPE, cwd=os.path.commonpath(libs))
8485
if versions.returncode != 0:
@@ -108,8 +109,7 @@ def build_bundle(libs, bundle_version, output_filename,
108109
build_metadata = {"build-tools-version": build_tools_version}
109110
bundle.comment = json.dumps(build_metadata).encode("utf-8")
110111
if multiple_libs:
111-
readme_zip_dir = build_dir.replace(".zip", "")
112-
total_size += add_file(bundle, "README.txt", os.path.join(readme_zip_dir, "README.txt"))
112+
total_size += add_file(bundle, "README.txt", os.path.join(top_folder, "README.txt"))
113113
for root, dirs, files in os.walk(build_dir):
114114
ziproot = root[len(build_dir + "/"):]
115115
for filename in files:

0 commit comments

Comments
 (0)