diff --git a/.gitignore b/.gitignore index a4db357..886dc1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/node_modules/** .DS_Store +build/** diff --git a/package-list.yaml b/package-list.yaml index cc9cfe1..d22ae6c 100644 --- a/package-list.yaml +++ b/package-list.yaml @@ -1,16 +1,18 @@ --- packages: - - name: arduino-modulino-mpy + - name: Arduino Modulino url: https://github.com/arduino/arduino-modulino-mpy author: Arduino, Sebastian Romero description: A MicroPython library to control Arduino Modulinos. docs: https://github.com/arduino/arduino-modulino-mpy/blob/main/docs/api.md tags: ["sensors", "actuators"] + license: Mozilla Public License Version 2.0 - name: micropython-modbus url: https://github.com/brainelectronics/micropython-modbus author: brainelectronics description: MicroPython ModBus TCP and RTU library supporting client and host mode tags: ["modbus"] + license: GNU General Public License - name: arduino-iot-cloud-py url: https://github.com/arduino/arduino-iot-cloud-py author: Arduino @@ -22,7 +24,7 @@ packages: library_version: "0.0.7" micropython_version: "1.19.1" tester: "arduino" - + license: Mozilla Public License Version 2.0 - name: BME680-Micropython url: https://github.com/robert-hh/BME680-Micropython author: Robert Hammelrath @@ -60,6 +62,7 @@ packages: library_version: null micropython_version: "1.19.1" tester: "arduino" + license: MIT License - name: micropython_servo_pdm author: Taras Prokofiev url: https://github.com/TTitanUA/micropython_servo_pdm @@ -76,34 +79,37 @@ packages: library_version: null micropython_version: "1.19.1" tester: "arduino" - - name: lcd - url: https://github.com/dhylands/python_lcd/ - description: Python code for talking to HD44780 compatible character based dot matrix LCDs. - license: MIT license; Copyright (c) 2013 Dave Hylands - tags: ["display", "LCD"] + license: MIT License - name: picoservo url: https://github.com/sandbo00/picoservo + author: sandbo00 description: A simple class for controlling a 9g servo with the Raspberry Pi Pico. tags: ["servo"] package_descriptor: urls: - [servo.py, github:sandbo00/picoservo/servo.py] + license: MIT License - name: micropython-DS3231-AT24C32 url: https://github.com/pangopi/micropython-DS3231-AT24C32 + author: pangopi description: MicroPython driver for DS3231 RTC and AT24C32 EEPROM module. tags: ["time", "RTC"] package_descriptor: urls: - [ds3231.py, github:pangopi/micropython-DS3231-AT24C32/ds3231.py] + license: MIT License - name: micropython_ahtx0 url: https://github.com/targetblank/micropython_ahtx0 + author: targetblank description: MicroPython driver for the AHT10 and AHT20 temperature and humidity sensors. tags: ["sensors", "temperature", "humidity"] package_descriptor: urls: - [ahtx0.py, github:targetblank/micropython_ahtx0/ahtx0.py] + license: MIT License - name: micropython-dfplayer url: https://github.com/ubidefeo/micropython-dfplayer + author: Ubi de Feo description: Micropython implementation of DFPlayer control over UART tags: ["audio", "mp3"] verification: @@ -111,20 +117,27 @@ packages: library_version: null micropython_version: "1.19.1" tester: "arduino" + license: MIT License - name: MAX30102-MicroPython-driver url: https://github.com/n-elia/MAX30102-MicroPython-driver + author: n-elia description: A port of the SparkFun driver for Maxim MAX30102 sensor to MicroPython. tags: ["sensors"] + license: MIT License - name: micropython-i2c-lcd url: https://github.com/ubidefeo/micropython-i2c-lcd + author: Ubi de Feo description: This library is designed to support a MicroPython interface for i2c LCD character screens. It is designed around the Pycom implementation of MicroPython tags: ["display", "LCD", "RGB"] + license: MIT License - name: micropython-i2c-lcd-monochrome url: https://github.com/brainelectronics/micropython-i2c-lcd + author: brainelectronics description: Micropython package to control HD44780 LCD displays 1602 and 2004 via I2C license: MIT - name: sh1107-micropython url: https://github.com/nemart69/sh1107-micropython + author: nemart69 description: Micropython driver for SH1107-based OLED display (64 x 128) tags: ["display", "OLED"] package_descriptor: @@ -132,37 +145,45 @@ packages: - [sh1107.py, github:nemart69/sh1107-micropython/sh1107.py] - name: SH1106 url: https://github.com/robert-hh/SH1106 + author: Robert Hammelrath description: MicroPython driver for the SH1106 OLED controller tags: ["display", "OLED"] package_descriptor: urls: - [sh1106.py, github:robert-hh/SH1106/sh1106.py] + license: MIT License - name: micropython-ir-rx url: https://github.com/peterhinch/micropython_ir/ir_rx + author: Peter Hinch description: Nonblocking device drivers to receive from IR (infra red) remotes. tags: ["IR"] license: MIT - name: micropython-ir-tx url: https://github.com/peterhinch/micropython_ir/ir_tx + author: Peter Hinch description: Nonblocking device drivers for IR (infra red) blaster apps. tags: ["IR"] license: MIT - name: pi_pico_neopixel url: https://github.com/blaz-r/pi_pico_neopixel - description: a library for using ws2812b and sk6812 leds (aka neopixels) with Raspberry Pi Pico + author: blaz-r + description: A library for using WS2812b and SK6812 LEDs (aka neopixels) with Raspberry Pi Pico. tags: ["LED"] package_descriptor: urls: - [neopixel.py, github:blaz-r/pi_pico_neopixel/neopixel.py] + license: MIT License - name: micropython-thermal-printer url: https://github.com/ayoy/micropython-thermal-printer - description: This is the MicroPython port of Python Thermal Printer by Adafruit + author: ayoy + description: This is the MicroPython port of Python Thermal Printer by Adafruit. tags: ["printer"] package_descriptor: urls: - [Adafruit_Thermal.py, github:ayoy/micropython-thermal-printer/Adafruit_Thermal.py] - name: micropython-tm1637 url: https://github.com/mcauser/micropython-tm1637 + author: Mike Causer description: A MicroPython library for quad 7-segment LED display modules using the TM1637 LED driver. For example, the Grove - 4 Digit Display module http://wiki.seeed.cc/Grove-4-Digit_Display/ tags: ["display"] verification: @@ -173,7 +194,7 @@ packages: - name: MicroPython-Button author: Ubi de Feo url: https://github.com/ubidefeo/MicroPython-Button - description: An easy to use MicroPython library to handle Buttons and other devices with digital (LOW/HIGH) output. + description: An easy-to-use MicroPython library to handle buttons and other devices with digital (LOW/HIGH) output. tags: ["input", "button"] verification: - fqbn: "arduino:mbed_nano:nanorp2040connect" @@ -182,7 +203,8 @@ packages: tester: "arduino" - name: micropython-max7219 url: https://github.com/mcauser/micropython-max7219 - description: A MicroPython library for the MAX7219 8x8 LED matrix driver, SPI interface, supports cascading and uses framebuf + author: Mike Causer + description: A MicroPython library for the MAX7219 8x8 LED matrix driver, SPI interface, supports cascading and uses framebuf. tags: ["LED", "matrix"] license: Licensed under the MIT License. package_descriptor: @@ -190,7 +212,8 @@ packages: - [max7219.py, github:mcauser/micropython-max7219/max7219.py] - name: BME280 url: https://github.com/robert-hh/BME280 - description: Micropython driver for the BME280 sensor, target platform Pycom devices + description: MicroPython driver for the BME280 sensor, target platform Pycom devices. + author: Robert Hammelrath tags: ["pressure", "temperature", "humidity"] package_descriptor: urls: @@ -198,7 +221,8 @@ packages: - [bme280_float.py, github:robert-hh/BME280/bme280_float.py] - name: HT16K33-Python url: https://github.com/smittytone/HT16K33-Python - description: Python drivers for the Holtek HT16K33 controller chip and various display devices based upon it, such as the Adafruit 0.8-inch 8x16 LED Matrix FeatherWing and the Raspberry Pi Pico. The drivers supports both CircuitPython and MicroPython applications. They communicate using I²C. + author: smittytone + description: Python drivers for the Holtek HT16K33 controller chip and various display devices based upon it, such as the Adafruit 0.8-inch 8x16 LED Matrix FeatherWing and the Raspberry Pi Pico. The drivers support both CircuitPython and MicroPython applications. They communicate using I²C. tags: ["LED", "matrix", "segment", "adafruit"] license: Licensed under the MIT License. verification: @@ -213,6 +237,6 @@ packages: - name: ucPack-mpy url: https://github.com/arduino/ucPack-mpy author: Arduino, Giovanni di Dio Bruno, Lucio Rossi - description: A MicroPython porting of ucPack library. + description: A MicroPython porting of the ucPack library. tags: ["communication"] - license: Licensed under MPL2.0. + license: Mozilla Public License Version 2.0 diff --git a/tools/create-index.mjs b/tools/create-index.mjs index 61c2165..91d9351 100644 --- a/tools/create-index.mjs +++ b/tools/create-index.mjs @@ -3,6 +3,17 @@ import path from 'path'; import { execSync } from 'child_process'; import yaml from 'js-yaml'; +const cloneRepository = (url, directory) => { + try { + // Clone the repository + execSync(`git clone ${url} ${directory}`); + return true; + } catch (error) { + console.error(`Error cloning repository: ${error.message}`); + return false; + } +}; + const getGitHubUrl = (rootPath) => { try { // Get the GitHub repository URL @@ -63,12 +74,18 @@ const searchPackages = (directory, outputFilename, indexUrl) => { } else { const isPackageJson = file === 'package.json'; const isManifestPy = file === 'manifest.py'; + const packageName = path.basename(dir); + + if(packageName.startsWith("_")) { + continue; // Skip "private" packages + } if (isPackageJson || isManifestPy) { const packageInfo = { - name: path.basename(dir), + name: packageName, docs: constructGitHubUrl(gitHubUrl, currentBranch, repositoryRoot, dir), index: indexUrl, + author: 'MicroPython', }; if (isManifestPy) { @@ -109,14 +126,22 @@ const searchPackages = (directory, outputFilename, indexUrl) => { }; // Check if command line arguments are provided -if (process.argv.length < 5) { +if (process.argv.length < 3) { // Note: Official MicroPython lib index is: https://micropython.org/pi/v2 - // Example usage: node create-index.mjs ../micropython-lib/micropython micropython-lib.yml https://micropython.org/pi/v2 - console.error('Usage: node create-index.mjs '); + // Example usage: node create-index.mjs micropython-lib.yml + console.error('Usage: node create-index.mjs '); } else { - const directory = process.argv[2]; - const outputFilename = process.argv[3]; - const indexUrl = process.argv[4]; + // Make build directory if it doesn't exist + if (!fs.existsSync('build')) { + fs.mkdirSync('build'); + } + + if(!fs.existsSync('build/micropython-lib')) { + cloneRepository("git@github.com:micropython/micropython-lib.git", "build/micropython-lib"); + } + const directory = "build/micropython-lib"; + const indexUrl = "https://micropython.org/pi/v2"; + const outputFilename = process.argv[2]; searchPackages(directory, outputFilename, indexUrl); } diff --git a/tools/find-license.mjs b/tools/find-license.mjs new file mode 100644 index 0000000..fc5165e --- /dev/null +++ b/tools/find-license.mjs @@ -0,0 +1,33 @@ +function convertToRawURL(url, suffix = null) { + url = url.replace('https://github.com/', ''); + const parts = url.split('/'); + const owner = parts[0]; + const repoName = parts[1]; + const branch = 'HEAD'; + let path = parts[2] ? "/" + parts[2] : ''; + if (suffix) { + path += "/" + suffix; + } + return `https://raw.githubusercontent.com/${owner}/${repoName}/${branch}${path}`; +} + +async function findLicenseURL(url) { + const licenseFileURL = convertToRawURL(url, 'LICENSE'); + // Fetch the license file + const licenseResponse = await fetch(licenseFileURL); + if (licenseResponse.ok) { + const licenseText = await licenseResponse.text(); + // Get the first line of the license file + const license = licenseText.split('\n')[0]; + return license; + } + return null; +} + +if(process.argv.length < 3) { + console.error('Usage: node find-license.mjs '); + process.exit(1); +} + +const license = await findLicenseURL(process.argv[2]); +if (license) console.log(license); \ No newline at end of file