aboutsummaryrefslogtreecommitdiff
path: root/cbcbuild.py
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-06-26 01:00:19 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-06-26 01:00:19 -0400
commit3f6e82f632027904e2912664cbb1c60cdc79a509 (patch)
tree58eb6e25884663912ccb3c4add4565c7f375851b /cbcbuild.py
parent973725aa1985ca4fab62bff0afe29a8fb8f96b6d (diff)
downloadcbc-3f6e82f632027904e2912664cbb1c60cdc79a509.tar.gz
* Big ole fixes.
* No more inline webserver, get your own, or run cbc/server.py manually. * Will refuse to rebuild packages if build number matches the installed version of the same package * Introduced cbc.utils, because cbcbuild was getting ugly.
Diffstat (limited to 'cbcbuild.py')
-rw-r--r--cbcbuild.py41
1 files changed, 20 insertions, 21 deletions
diff --git a/cbcbuild.py b/cbcbuild.py
index fbdf017..35453e5 100644
--- a/cbcbuild.py
+++ b/cbcbuild.py
@@ -6,43 +6,42 @@ import conda_build.metadata
import conda_build.build
import argparse
import time
-from subprocess import check_output, CalledProcessError
+from cbc.exceptions import CondaBuildError
parser = argparse.ArgumentParser()
parser.add_argument('cbcfile', action='store', nargs='*', help='Build configuration file')
-
-input_test = ['tests/data/astropy-helpers.ini', 'tests/data/astropy.ini']
-#input_test = ['tests/data/d2to1.ini']
-args = parser.parse_args(input_test)
+args = parser.parse_args()
os.environ['CBC_HOME'] = 'tests/data/build'
env = cbc.environment.Environment()
+# Convert cbcfile paths to absolute paths
+args.cbcfile = [ os.path.abspath(x) for x in args.cbcfile ]
+# Verify we have a file that exists
+for cbcfile in args.cbcfile:
+ if not os.path.exists(cbcfile):
+ print('{} does not exist.'.format(cbcfile))
+ exit(1)
+ elif not os.path.isfile(cbcfile):
+ print('{} is not a file.'.format(cbcfile))
+ exit(1)
+
+# Perform build(s)
for cbcfile in args.cbcfile:
- # Ensure the working directory remains stable per build.
+ # Ensure the working directory remains the same throughout.
os.chdir(env.pwd)
metadata = cbc.meta.MetaData(cbcfile, env)
- metadata.env.mkpkgdir(metadata.local['package']['name'])
+ metadata.env.mkpkgdir(metadata.local['package']['name'])
metadata.render_scripts()
conda_metadata = conda_build.metadata.MetaData(env.pkgdir)
- if 'cbc_cgi' in metadata.local_metadata:
- if metadata.local_metadata['cbc_cgi']['local_server']:
- fileserver = cbc.server.FileServer(metadata.local_metadata['cbc_cgi']['local_port'],
- metadata.local_metadata['cbc_cgi']['local_sources'],
- run=True)
+ if cbc.utils.conda_search(conda_metadata.name()) == conda_metadata.dist():
+ print('{0} metadata matches an installed package; increment the build number to rebuild.'.format(conda_metadata.dist()))
+ continue
conda_build.build.build(conda_metadata, get_src=True, verbose=True)
-
- # Until I can figure out a good way to build with the conda API
- # we'll use the CLI:
- command = 'conda install --use-local --yes {0}'.format(conda_metadata.name()).split()
- try:
- for line in (check_output(command).decode('utf-8').splitlines()):
- print(line)
- except CalledProcessError as cpe:
- print('{0} exit={1}'.format(cpe.cmd, cpe.returncode))
+ cbc.utils.conda_install(conda_metadata.name())
\ No newline at end of file