Skip to content

Commit

Permalink
[NB] Use Conda build jinja template support
Browse files Browse the repository at this point in the history
Use Conda build [jinja template support][1].

Conda package can be built directly from source directory by running:

    conda build .conda-recipe

[1]: http://conda.pydata.org/docs/building/meta-yaml.html#templating-with-jinja
  • Loading branch information
cfobel committed Oct 6, 2016
1 parent 12f5a31 commit c4d3b53
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 22 deletions.
12 changes: 0 additions & 12 deletions .conda-recipe-template/bld.bat

This file was deleted.

File renamed without changes.
37 changes: 37 additions & 0 deletions .conda-recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@echo off
REM Construct version tag from Conda [Git environment variables][1].
REM
REM [1]: http://conda.pydata.org/docs/building/environment-vars.html#git-environment-variables
set MINOR_VERSION=%GIT_DESCRIBE_TAG:~1%
if %GIT_DESCRIBE_NUMBER%==0 (
set PACKAGE_VERSION=%MINOR_VERSION%
) else (
set PACKAGE_VERSION=%MINOR_VERSION%.post%GIT_DESCRIBE_NUMBER%
)

REM Generate `setup.py` from `pavement.py` definition.
"%PYTHON%" -m paver generate_setup

REM **Workaround** `conda build` runs a copy of `setup.py` named
REM `conda-build-script.py` with the recipe directory as the only argument.
REM This causes paver to fail, since the recipe directory is not a valid paver
REM task name.
REM
REM We can work around this by popping the recipe directory command line
REM argument off if the `setup.py` script is run under the name
REM `conda-build-script.py`.
"%PYTHON%" -c "input_ = open('setup.py', 'r'); data = input_.read(); input_.close(); output_ = open('setup.py', 'w'); output_.write('\n'.join(['import sys', 'import path_helpers as ph', '''if ph.path(sys.argv[0]).name == 'conda-build-script.py':''', ' sys.argv.pop()', data])); output_.close(); print open('setup.py', 'r').read()"

REM Install source directory as Python package.
"%PYTHON%" -m pip install --no-cache --find-links http://192.99.4.95/wheels --trusted-host 192.99.4.95 .
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: for a list of environment variables that are set during the build process.
if not exist "%PREFIX%\Menu" mkdir "%PREFIX%\Menu"
copy "%RECIPE_DIR%\microdrop.ico" "%PREFIX%\Menu"
copy "%RECIPE_DIR%\Iconleak-Atrous-Console.ico" "%PREFIX%\Menu"
copy "%RECIPE_DIR%\microdrop-launcher.json" "%PREFIX%\Menu"
26 changes: 16 additions & 10 deletions .conda-recipe-template/meta.yaml → .conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package:
name: {{ conda_package_name }}
version: {{ version }}
name: microdrop-launcher
{% if GIT_DESCRIBE_NUMBER > '0' %}
version: {{ GIT_DESCRIBE_TAG[1:] }}.post{{ GIT_DESCRIBE_NUMBER }}
{% else %}
version: {{ GIT_DESCRIBE_TAG[1:] }}
{% endif %}

build:
# entry_points:
# Put any entry points (scripts to be generated automatically) here. The
# syntax is module:function. For example
#
# - msgpack-python = msgpack-python:main
#
# Would create an entry point called msgpack-python that calls msgpack-python.main()
entry_points:
- microdrop-profile-manager = microdrop_launcher.bin.profile_launcher:main
- launch-microdrop = microdrop_launcher.bin.launch:main

# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
number: {{ build_number }}
number: 0

requirements:
build:
Expand All @@ -22,6 +22,7 @@ requirements:
- futures
- jinja2
- microdrop-plugin-manager >=0.3.post6
- paver
- pip-helpers >=0.6.post3
- pycairo-gtk2
- wheeler.pygtkhelpers >=0.14.post7
Expand All @@ -35,6 +36,11 @@ requirements:
- pycairo-gtk2
- wheeler.pygtkhelpers >=0.14.post7

# source will be downloaded prior to filling in jinja templates
# Example assumes that this folder has setup.py in it
source:
git_url: ../

about:
home: http://github.com/wheeler-microfluidics/microdrop-launcher
license: GPL
File renamed without changes.
File renamed without changes.

0 comments on commit c4d3b53

Please sign in to comment.