3636import subprocess
3737import tempfile
3838
39+ # pyproject.toml `py_modules` values that are incorrect. These should all have PRs filed!
40+ # and should be removed when the fixed version is incorporated in its respective bundle.
41+
42+ pyproject_py_modules_blacklist = set ((
43+ # adafruit bundle
44+ "adafruit_colorsys" ,
45+
46+ # community bundle
47+ "at24mac_eeprom" ,
48+ "circuitpython_Candlesticks" ,
49+ "CircuitPython_Color_Picker" ,
50+ "CircuitPython_Equalizer" ,
51+ "CircuitPython_Scales" ,
52+ "circuitPython_Slider" ,
53+ "circuitpython_uboxplot" ,
54+ "P1AM" ,
55+ "p1am_200_helpers" ,
56+ ))
57+
3958if sys .version_info >= (3 , 11 ):
4059 from tomllib import loads as load_toml
4160else :
@@ -175,6 +194,12 @@ def get_package_info(library_path, package_folder_prefix):
175194 py_modules = get_nested (pyproject_toml , "tool" , "setuptools" , "py-modules" , default = [])
176195 packages = get_nested (pyproject_toml , "tool" , "setuptools" , "packages" , default = [])
177196
197+ blacklisted = [name for name in py_modules if name in pyproject_py_modules_blacklist ]
198+
199+ if blacklisted :
200+ print (f"{ lib_path } /settings.toml:1: { blacklisted [0 ]} blacklisted: not using metadata from pyproject.toml" )
201+ py_modules = packages = ()
202+
178203 example_files = [sub_path for sub_path in (lib_path / "examples" ).rglob ("*" )
179204 if sub_path .is_file ()]
180205
@@ -185,7 +210,7 @@ def get_package_info(library_path, package_folder_prefix):
185210 if len (packages ) > 1 :
186211 raise ValueError ("Only a single package is supported" )
187212 package_name = packages [0 ]
188- print (f"Using package name from pyproject.toml: { package_name } " )
213+ # print(f"Using package name from pyproject.toml: {package_name}")
189214 package_info ["is_package" ] = True
190215 package_info ["module_name" ] = package_name
191216 package_files = [sub_path for sub_path in (lib_path / package_name ).rglob ("*" )
@@ -194,15 +219,15 @@ def get_package_info(library_path, package_folder_prefix):
194219 elif py_modules :
195220 if len (py_modules ) > 1 :
196221 raise ValueError ("Only a single module is supported" )
197- print ("Using module name from pyproject.toml" )
198222 py_module = py_modules [0 ]
223+ #print(f"Using module name from pyproject.toml: {py_module}")
199224 package_name = py_module
200225 package_info ["is_package" ] = False
201226 package_info ["module_name" ] = py_module
202227 py_files = [lib_path / f"{ py_module } .py" ]
203228
204229 else :
205- print (" Using legacy autodetection" )
230+ print (f" { lib_path } : Using legacy autodetection" )
206231 package_info ["is_package" ] = False
207232 for file in glob_search :
208233 if file .parts [parent_idx ] != "examples" :
0 commit comments