-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpush_env_packages.py
More file actions
39 lines (36 loc) · 1.12 KB
/
push_env_packages.py
File metadata and controls
39 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from __future__ import print_function
from subprocess import Popen, PIPE
import os
import sys
import shlex
def run_cmd(cmd, verbose=False):
if verbose:
print("Executing :",cmd)
p = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
o,e = p.communicate()
return o,e
if sys.platform == "darwin":
conda_os = "osx-64"
else:
conda_os = "linux-64"
conda_pkgs = os.path.abspath(os.path.join(os.environ.get("CONDA_EXE"),"..","..","pkgs"))
# Get list of package we are using
pkgs, err = run_cmd("conda list", verbose=True)
missing = []
for l in pkgs.decode("utf8").split("\n")[2:-1]:
sp = l.split()
name = sp[0]
version = sp[1]
build = sp[2]
tarname = "{}-{}-{}.tar.bz2".format(name,version,build)
tarball = os.path.join(conda_pkgs,tarname)
print("looking at:",tarball,os.path.exists(tarball))
if os.path.exists(tarball):
o,e = run_cmd("anaconda upload {} -u cdat-forge".format(tarball), verbose=True)
print("OUT:",o.decode("utf8"))
print("Err:",e.decode("utf8"))
else:
missing.append(tarball)
print(sys.prefix)
print(conda_pkgs)
print("Error on:",missing)