Last active
March 24, 2017 15:11
-
-
Save gordonbrander/e4f24234e5a49f8840ad27ea08f627bc to your computer and use it in GitHub Desktop.
Vendor all openag firmware in one fell swoop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script fetches the latest master of all of the openag firmware repositories, then removes the `.git`, etc. | |
""" | |
import subprocess | |
import argparse | |
from os import path | |
LIBS = set(( | |
"https://github.com/OpenAgInitiative/openag_firmware_module.git", | |
"https://github.com/OpenAgInitiative/rosserial_arduino_libs.git", | |
"https://github.com/OpenAgInitiative/openag_pulse_actuator.git", | |
"https://github.com/OpenAgInitiative/openag_doser_pump.git", | |
"https://github.com/OpenAgInitiative/openag_air_flush.git", | |
"https://github.com/OpenAgInitiative/openag_tone_actuator.git", | |
"https://github.com/OpenAgInitiative/openag_bh1750.git", | |
"https://github.com/OpenAgInitiative/openag_mhz19.git", | |
"https://github.com/OpenAgInitiative/openag_binary_sensor.git", | |
"https://github.com/OpenAgInitiative/openag_atlas_do.git", | |
"https://github.com/OpenAgInitiative/openag_atlas_orp.git", | |
"https://github.com/OpenAgInitiative/openag_mhz16.git", | |
"https://github.com/OpenAgInitiative/openag_software_pwm_actuator.git", | |
"https://github.com/OpenAgInitiative/openag_dht22.git", | |
"https://github.com/OpenAgInitiative/openag_ds18b20.git", | |
"https://github.com/OpenAgInitiative/openag_atlas_ec.git", | |
"https://github.com/OpenAgInitiative/openag_atlas_ph.git", | |
"https://github.com/OpenAgInitiative/openag_gc0012.git", | |
"https://github.com/OpenAgInitiative/openag_atlas_rgb.git", | |
"https://github.com/OpenAgInitiative/openag_am2315.git", | |
"https://github.com/OpenAgInitiative/openag_pwm_actuator.git", | |
"https://github.com/OpenAgInitiative/openag_binary_actuator.git" | |
)) | |
def read_file_name(url): | |
file_name, ext = path.splitext(path.basename(url)) | |
return file_name | |
def git_export_remote(repo_url, cwd="."): | |
return subprocess.call( | |
("git", "clone", "--depth", "1", repo_url), cwd=cwd) | |
def clean_export(cwd): | |
junk = (".git", ".gitmodules", ".travis.yml") | |
return subprocess.call( | |
("rm", "-rf") + junk, cwd=cwd) | |
parser = argparse.ArgumentParser() | |
parser.add_argument( | |
"out_dir", | |
type=str | |
) | |
if __name__ == "__main__": | |
args = parser.parse_args() | |
for git_url in LIBS: | |
git_export_remote(git_url, args.out_dir) | |
repo_name = read_file_name(git_url) | |
repo_path = path.join(args.out_dir, repo_name) | |
clean_export(repo_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment