Skip to content

Commit aae59c9

Browse files
committed
Don't mpy __init__.py and saner build directory.
1 parent e09d82a commit aae59c9

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
__pycache__
2+
*.zip

circuitpython_build_tools.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import sys
2929
import subprocess
3030

31-
IGNORE_PY = ["setup.py", "conf.py"]
31+
IGNORE_PY = ["setup.py", "conf.py", "__init__.py"]
3232

3333
def build_mpy_cross(mpy_cross_filename, circuitpython_tag, quiet=False):
3434
if not quiet:
@@ -84,6 +84,7 @@ def build_library(library_path, output_directory, mpy_cross=None):
8484
os.makedirs(base_dir)
8585
total_size += 512
8686

87+
8788
new_extension = ".py"
8889
if mpy_cross:
8990
new_extension = ".mpy"
@@ -103,13 +104,14 @@ def build_library(library_path, output_directory, mpy_cross=None):
103104

104105
for filename in package_files:
105106
full_path = os.path.join(library_path, filename)
106-
output_file = os.path.join(output_directory,
107-
filename.replace(".py", new_extension))
108107
if (not mpy_cross or
109108
os.stat(full_path).st_size == 0 or
110109
filename.endswith("__init__.py")):
110+
output_file = os.path.join(output_directory, filename)
111111
shutil.copyfile(full_path, output_file)
112112
else:
113+
output_file = os.path.join(output_directory,
114+
filename.replace(".py", new_extension))
113115
mpy_success = subprocess.call([mpy_cross,
114116
"-o", output_file,
115117
full_path])

scripts/build_bundles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def add_file(bundle, src_file, zip_name):
4545

4646
def build_bundle(lib_location, bundle_version, output_filename,
4747
mpy_cross=None):
48-
build_dir = "build-" + output_filename
48+
build_dir = "build-" + os.path.basename(output_filename)
4949
build_lib_dir = os.path.join(build_dir, "lib")
5050
if os.path.isdir(build_dir):
5151
print("Deleting existing build.")

0 commit comments

Comments
 (0)