Last active
August 29, 2015 14:08
-
-
Save hhuuggoo/3ebc3dc934ce0723ab3e to your computer and use it in GitHub Desktop.
building a bunch of conda packages
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
import os | |
from os.path import join, getctime, dirname | |
import glob | |
import subprocess | |
import argparse | |
def newest_file(root): | |
path = join(root, "*tar.bz2") | |
newest = max(glob.iglob(path), key=getctime) | |
return newest | |
def upload(pkg, user): | |
cmd = ["binstar", "upload", "--force","-u", user, pkg] | |
subprocess.check_call(cmd) | |
def build(recipe, build_path, pythons=[], platforms=[], binstar_user=None): | |
print (recipe, pythons, platforms) | |
for p in pythons: | |
cmd = ["conda", "build", recipe, "--python", p] | |
subprocess.check_call(cmd) | |
pkg = newest_file(build_path) | |
if binstar_user: | |
upload(pkg, binstar_user) | |
for plat in platforms: | |
cmd = ["conda", "convert", "-p", plat, pkg] | |
subprocess.check_call(cmd) | |
if binstar_user: | |
to_upload = newest_file(plat) | |
upload(to_upload, binstar_user) | |
if __name__ == "__main__": | |
p = argparse.ArgumentParser() | |
p.add_argument("build_dir") | |
p.add_argument("--py", action="append", default=[]) | |
p.add_argument("--plat", action="append", default=[]) | |
p.add_argument("-u", "--binstar-user", help="binstar user") | |
args = p.parse_args() | |
build_dir = p.add_argument("build_dir") | |
build("flask-login", args.build_dir, args.py, args.plat, args.binstar_user) | |
build("flask-sqlalchemy", args.build_dir, args.py, args.plat, args.binstar_user) | |
""" | |
python build.py /opt/anaconda/conda-bld/linux-64 --py 27 --py 34 --plat osx-64 --plat win-64 -u hugo | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment