Skip to content

Commit

Permalink
Merge pull request #965 from psavery/always-use-latest-hexrd
Browse files Browse the repository at this point in the history
Get packaging to always use the latest hexrd
  • Loading branch information
joelvbernier authored Jun 30, 2021
2 parents 2096dad + 4b43924 commit 6a8268a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ jobs:
python packaging/github_action_version.py ${{ steps.hexrdgui_describe.outputs.version }} minor
python packaging/github_action_version.py ${{ steps.hexrdgui_describe.outputs.version }} patch
- name: Set channel for HEXRD
run: echo "HEXRD_PACKAGE_CHANNEL=HEXRD" >> $GITHUB_ENV

# - name: Set channel for HEXRD ( hexrd or hexrd-prerelease )
# run: |
# [[ ${{ github.event_name }} = 'push' && ${{ github.ref }} = 'refs/heads/master' ]] && echo "HEXRD_PACKAGE_CHANNEL=HEXRD" >> $GITHUB_ENV || echo "HEXRD_PACKAGE_CHANNEL=HEXRD/label/hexrd-prerelease" >> $GITHUB_ENV
- name: Set channel for HEXRD ( hexrd or hexrd-prerelease )
run: |
[[ ${{ github.event_name }} = 'push' && ${{ github.ref }} = 'refs/heads/master' ]] && echo "HEXRD_PACKAGE_CHANNEL=HEXRD" >> $GITHUB_ENV || echo "HEXRD_PACKAGE_CHANNEL=HEXRD/label/hexrd-prerelease" >> $GITHUB_ENV
- name: Create conda environment to build HEXRDGUI
working-directory: hexrdgui
Expand Down
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ requirements:
- importlib_resources
- fabio
- pyyaml
- hexrd==0.8.8
- hexrd=={{ hexrd_version }}
- pyhdf
- silx

Expand Down
32 changes: 23 additions & 9 deletions packaging/package.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import tempfile
from pathlib import Path
import tarfile
import zipfile
import json
import logging
import shutil
import sys
import stat
import os
from pathlib import Path
import platform
import click
import shutil
import stat
import sys
import tarfile
import tempfile
import zipfile

import click
import coloredlogs

import conda.cli.python_api as Conda
Expand Down Expand Up @@ -111,6 +112,19 @@ def build_conda_pack(base_path, tmp, hexrd_package_channel, hexrdgui_output_fold
config.channel.insert(0, 'hexrd-channel')
config.channel_urls.insert(0, hexrd_package_channel)

# Determine the latest hexrd version in the hexrd_package_channel
# (release or pre-release), and force that hexrd version to be used.
params = [
Conda.Commands.SEARCH,
'--channel', hexrd_package_channel,
'--json',
'hexrd',
]
output = Conda.run_command(*params)
results = json.loads(output[0])
hexrd_version = results['hexrd'][-1]['version']
config.variant['hexrd_version'] = hexrd_version

config.CONDA_PY = '38'
logger.info('Building hexrdgui conda package.')
CondaBuild.build(recipe_path, config=config)
Expand Down Expand Up @@ -146,7 +160,7 @@ def build_conda_pack(base_path, tmp, hexrd_package_channel, hexrdgui_output_fold
'--channel', 'cjh1',
'--channel', 'anaconda',
'--channel', 'conda-forge',
'hexrd==0.8.8',
f'hexrd=={hexrd_version}',
'hexrdgui'
]
Conda.run_command(*params)
Expand Down

0 comments on commit 6a8268a

Please sign in to comment.