forked from python-microscopy/python-microscopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildCondaPackage.py
41 lines (28 loc) · 936 Bytes
/
buildCondaPackage.py
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
40
41
# -*- coding: utf-8 -*-
"""
Created on Sat May 9 09:39:19 2015
@author: david
"""
import os
import sys
import subprocess
import json
sys.path.append('.')
from PYME import update_version
update_version.update_version()
from PYME import version
os.environ['PYME_VERSION'] = version.version
def get_package_versions(packagename):
s = subprocess.check_output(['conda', 'search', '--json',packagename])
packages = json.loads(s)[packagename]
return packages
#find out if there are any previous builds for this version
#import conda.api
prev_builds = [p['build_number'] for p in get_package_versions('python-microscopy') if p['version'] == version.version]
print('%d previous builds of this version' % len(prev_builds))
if len(prev_builds) > 0:
os.environ['BUILD_NUM'] = str(max(prev_builds) +1)
os.chdir('conda-recipes')
ret = os.system('conda build python-microscopy')
if not ret == 0:
sys.exit(ret)