def get_frozen(stub_path=None, *, repo=None, version='3.2.24'): "Loboris frozen modules" if not stub_path: stub_path = Path('./all-stubs') / "{}-{}-frozen".format(FAMILY, utils.flat_version(version) ) else: stub_path = Path(stub_path) if not repo: repo = 'https://raw.githubusercontent.com/loboris/MicroPython_ESP32_psRAM_LoBo/master/MicroPython_BUILD/components/micropython/esp32/modules/{}' frozen_modules = ["README.md", "ak8963.py", "freesans20.py", "functools.py", "logging.py", "microWebSocket.py", "microWebSrv.py", "microWebTemplate.py", "mpu6500.py", "mpu9250.py", "pye.py", "ssd1306.py", "tpcalib.py", "upip.py", "upip_utarfile.py", "upysh.py", "urequests.py", "writer.py"] #download downloader.download_files(repo, frozen_modules, stub_path) # make a manifest utils.make_manifest(stub_path, FAMILY, "frozen", version=version)
def get_frozen( stub_path: str, version: str, mpy_path=None, lib_path=None, ): """ get and parse the to-be-fozen .py modules for micropython to extract the static type information - requires that the MicroPython and Micropython-lib repos are checked out and available on a local path repos should be cloned side-by-side as some of the manifests refer to micropython-lib scripts using a relative path """ if not mpy_path: mpy_path = '../micropython' if not lib_path: lib_path = '../micropython-lib' if not stub_path: stub_path = '{}/{}_{}_frozen'.format(utils.STUB_FOLDER, fmly, utils.flat_version(version)) # get the manifests of the different ports and boards mpy_path = os.path.abspath(mpy_path) lib_path = os.path.abspath(lib_path) stub_path = os.path.abspath(stub_path) # manifest.py is used for board specific and daily builds # manifest_release.py is used for the release builds manifests = ( glob.glob(mpy_path + '\\ports\\**\\manifest.py', recursive=True) + glob.glob(mpy_path + '\\ports\\**\\manifest_release.py', recursive=True)) # remove any manifests that are below one of the virtual environments (venv) \ # 'C:\\develop\\MyPython\\micropython\\ports\\esp32\\build-venv\\lib64\\python3.6\\site-packages\\pip\\_vendor\\distlib\\manifest.py' manifests = [m for m in manifests if not 'venv' in m] if len(manifests) > 0: log.debug('MicroPython v1.12 and newer') get_frozen_manifest(manifests, stub_path, mpy_path, lib_path, version) else: log.debug('MicroPython v1.11, older or other') # others get_frozen_folders(stub_path, mpy_path, lib_path, version)
def get_all(): "get all frozen modules for the current version of micropython" # get_cpython.get_core(stub_path=stubfolder('cpython_core'), requirements='./src/reqs-cpython-mpy.txt') mpy_path = '../micropython' version = clean_version(git.get_tag(mpy_path)) if version: log.info("found micropython version : {}".format(version)) # folder/{family}-{version}-frozen family = 'micropython' stub_path = stubfolder('{}-{}-frozen'.format(family, flat_version(version))) get_mpy.get_frozen(stub_path, version=version, mpy_path=mpy_path, lib_path='../micropython-lib') else: log.warning('Unable to find the micropython repo in folder : {}'.format(mpy_path)) get_lobo.get_frozen(stub_path=STUB_FOLDER + '/loboris-esp32_lobo_3_2_24' + '-frozen') # now generate typeshed files for all scripts log.info("Generate type hint files (pyi) in folder: {}".format(STUB_FOLDER)) utils.make_stub_files(STUB_FOLDER, levels=7)
get_frozen(stub_path='./scratch/mpy_1_10_0_Frozen', mpy_path='../micropython', lib_path='../micropython-lib', version='1.10.0') if __name__ == "__main__": "just gather for the current version" logging.basicConfig(format='%(levelname)-8s:%(message)s', level=logging.INFO) mpy_path = '../micropython' lib_path = '../micropython-lib' version = clean_version(git.get_tag(mpy_path)) if version: log.info("found micropython version : {}".format(version)) # folder/{family}_{version}_frozen family = 'mpy' stub_path = stubfolder('{}_{}_frozen'.format(family, flat_version(version))) get_frozen(stub_path, version=version, mpy_path=mpy_path, lib_path=lib_path) exit(0) else: log.warning( 'Unable to find the micropython repo in folder : {}'.format( mpy_path)) exit(1)