Skip to content

Commit

Permalink
Merge pull request #178 from birgorg/clone-br-feature
Browse files Browse the repository at this point in the history
Use birgorg/bioconda-recipes
  • Loading branch information
Hogfeldt authored Apr 5, 2020
2 parents bef4390 + c84874f commit 9cbadb7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 39 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ install:

before_script:

# Download Bioconda-recipe repository

- git clone https://github.com/bioconda/bioconda-recipes

# Install bioconda-recipe-gen

- python setup.py install
- pip install .

script:
- travis_wait 60 ./travis/test.sh $PACKAGE
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
packages=find_packages("src"),
package_dir={"": "src"},
test_suite="test",
install_requires=['docker>=2.0.0', 'gitdb2==2.0.5', 'validators'],
install_requires=['docker>=2.0.0', 'gitdb2==2.0.5', 'validators', 'gitpython'],
entry_points={
'console_scripts': ['bioconda-recipe-gen = bioconda_recipe_gen.cli:start'],
},
Expand Down
2 changes: 1 addition & 1 deletion src/bioconda_recipe_gen/bioconda_recipe_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from . import build


def main(bioconda_recipe_path, recipes, build_scripts, debug):
success = False
while not success and build_scripts:
Expand Down Expand Up @@ -34,6 +33,7 @@ def main(bioconda_recipe_path, recipes, build_scripts, debug):

# Sanity check
success = build.mini_sanity_check(bioconda_recipe_path, recipe)

# copy the final recipe into the current directory
copyfile(
os.path.join(recipe.path, "meta.yaml"),
Expand Down
32 changes: 10 additions & 22 deletions src/bioconda_recipe_gen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,24 @@
import sys
import logging
from shutil import rmtree
from tempfile import TemporaryDirectory
from git import Repo

from .bioconda_recipe_gen import main
from .preprocessors.from_files import preprocess as files_preprocess
from .preprocessors.sdist_optimization import sdist_optimization
from .template_generation import init

def bioconda_recipes_exists(path):
recipes_path = os.path.join(path, "recipes")
config_path = os.path.join(path, "config.yml")
return os.path.exists(recipes_path) and os.path.exists(config_path)


def call_main(args, recipes, build_scripts):
if bioconda_recipes_exists(args.bioconda_recipe_path):
main(args.bioconda_recipe_path, recipes, build_scripts, args.debug)
else:
sys.exit("ERROR: Wrong path to bioconda-recipes")

BIOCONDA_RECIPES = 'https://github.com/birgorg/bioconda-recipes'

def build(args):
recipes, build_scripts = files_preprocess(args)
if args.strategy == "python3" or args.strategy == "python2":
for recipe in recipes:
sdist_optimization(recipe)
call_main(args, recipes, build_scripts)

with TemporaryDirectory() as bioconda_recipe_path:
_ = Repo.clone_from(BIOCONDA_RECIPES, bioconda_recipe_path)
recipes, build_scripts = files_preprocess(args, bioconda_recipe_path)
if args.strategy == "python3" or args.strategy == "python2":
for recipe in recipes:
sdist_optimization(recipe)
main(bioconda_recipe_path, recipes, build_scripts, args.debug)

def setup_logging(debug, output_dir_path):
if debug:
Expand Down Expand Up @@ -69,10 +61,6 @@ def start():
"build",
help="Build the recipe from the template generate by 'init'"
)
parser_files.add_argument(
"bioconda_recipe_path",
help="Path to your local copy of the bioconda-recipe repository",
)
parser_files.add_argument(
"recipe_path",
help="Path to folder with meta.yaml and build.sh templates",
Expand Down
4 changes: 2 additions & 2 deletions src/bioconda_recipe_gen/preprocessors/from_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def create_build_script(recipe, args, filesystem):
return build_script


def preprocess(args):
recipe = create_recipe(args.bioconda_recipe_path, args.recipe_path, args.strategy)
def preprocess(args, bioconda_recipe_path):
recipe = create_recipe(bioconda_recipe_path, args.recipe_path, args.strategy)
with tempfile.TemporaryDirectory() as tmpdir:
download_and_unpack_source(recipe.url, tmpdir)
source_path = os.path.join(tmpdir, "source")
Expand Down
2 changes: 1 addition & 1 deletion src/bioconda_recipe_gen/template_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def create_path(name):
return path


def init(args):
def init(_):
name, version, url, strategy = get_user_input()
path = create_path(name)
recipe = make_recipe(name, version, url, path, strategy)
Expand Down
13 changes: 6 additions & 7 deletions travis/test.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
#!/bin/bash
##### Constants
# The TRAVIS_BUILD_DIR is specified by travis itself
BR_PATH=$TRAVIS_BUILD_DIR/bioconda-recipes
DATA_PATH=$TRAVIS_BUILD_DIR/travis/data

##### functions

build_htstream()
{
data=$DATA_PATH/htstream
bioconda-recipe-gen build $BR_PATH $data cmake
bioconda-recipe-gen build $data cmake
}

build_qfilt()
{
data=$DATA_PATH/qfilt
bioconda-recipe-gen build $BR_PATH $data cmake
bioconda-recipe-gen build $data cmake
}

build_libdivsufsort()
{
data=$DATA_PATH/libdivsufsort
bioconda-recipe-gen build $BR_PATH $data cmake
bioconda-recipe-gen build $data cmake
}

build_lambda()
{
data=$DATA_PATH/lambda
bioconda-recipe-gen build $BR_PATH $data cmake
bioconda-recipe-gen build $data cmake
}

build_fuma()
{
data=$DATA_PATH/fuma
yes | bioconda-recipe-gen build $BR_PATH $data python2
yes | bioconda-recipe-gen build $data python2
}

build_crossmap()
{
data=$DATA_PATH/crossmap
yes | bioconda-recipe-gen build $BR_PATH $data python3
yes | bioconda-recipe-gen build $data python3
}


Expand Down

0 comments on commit 9cbadb7

Please sign in to comment.