3030import subprocess
3131import zipfile
3232
33- import circuitpython_build_tools
33+ from circuitpython_build_tools import build
3434
3535
3636def add_file (bundle , src_file , zip_name ):
@@ -59,9 +59,7 @@ def build_bundle(lib_location, bundle_version, output_filename,
5959 for library in os .listdir (os .path .join ("libraries" , subdirectory )):
6060 library_path = os .path .join ("libraries" , subdirectory , library )
6161
62- circuitpython_build_tools .build_library (library_path ,
63- build_lib_dir ,
64- mpy_cross = mpy_cross )
62+ build .library (library_path , build_lib_dir , mpy_cross = mpy_cross )
6563
6664 with open (os .path .join (build_lib_dir , "VERSIONS.txt" ), "w" ) as f :
6765 f .write (bundle_version + "\r \n " )
@@ -97,15 +95,12 @@ def build_bundle(lib_location, bundle_version, output_filename,
9795
9896
9997if __name__ == "__main__" :
100- from scripts import target_versions
101-
102- tagged = input ("Did you tag this release already ([y]/n)? " )
103- if tagged and tagged .lower () != 'y' :
104- print ("Go ahead and tag. I'll wait." )
105- sys .exit (3 )
98+ from circuitpython_build_tools import target_versions
99+ from pkg_resources import resource_filename
106100
107101 bundle_lib_location = os .path .abspath (sys .argv [1 ])
108102 output_dir = os .path .abspath (sys .argv [2 ])
103+ os .makedirs (output_dir , exist_ok = True )
109104 os .chdir (bundle_lib_location )
110105
111106 bundle_version = None
@@ -123,8 +118,7 @@ def build_bundle(lib_location, bundle_version, output_filename,
123118 build_bundle (bundle_lib_location , bundle_version , zip_filename )
124119 os .makedirs ("build_deps" , exist_ok = True )
125120 for version in target_versions .VERSIONS :
126- mpy_cross = "build_deps/mpy-cross-" + version ["name" ]
127- circuitpython_build_tools .build_mpy_cross (mpy_cross , version ["tag" ])
121+ mpy_cross = resource_filename (target_versions .__name__ , "data/mpy-cross-" + version ["name" ])
128122 zip_filename = os .path .join (output_dir ,
129123 'adafruit-circuitpython-bundle-{TAG}-{VERSION}.zip' .format (
130124 TAG = version ["name" ],
0 commit comments