Permalink
Browse files

Coding on a plane and I want to use a local sqlite database...

... so lets add an option and make it setable in ~/.planemo.yml.
  • Loading branch information...
jmchilton committed Nov 2, 2015
1 parent 49c5c1e commit c23569ff7a48baa38a61c8f4b7caa7c83930d89a
Showing with 23 additions and 3 deletions.
  1. +13 −3 planemo/galaxy_config.py
  2. +10 −0 planemo/options.py
@@ -140,12 +140,13 @@ def config_join(*args):
preseeded_database = True
master_api_key = kwds.get("master_api_key", "test_key")
dependency_dir = os.path.join(config_directory, "deps")

galaxy_sqlite_database = kwds.get("galaxy_sqlite_database", None)
try:
_download_database_template(
galaxy_root,
database_location,
latest=latest_galaxy
latest=latest_galaxy,
galaxy_sqlite_database=galaxy_sqlite_database,
)
except Exception as e:
print(e)
@@ -358,7 +359,16 @@ def cleanup(self):
shutil.rmtree(self.config_directory)


def _download_database_template(galaxy_root, database_location, latest=False):
def _download_database_template(
galaxy_root,
database_location,
latest=False,
galaxy_sqlite_database=None
):
if galaxy_sqlite_database is not None:
shutil.copyfile(galaxy_sqlite_database, database_location)
return True

if latest:
template_url = DOWNLOADS_URL + urlopen(LATEST_URL).read()
urlretrieve(template_url, database_location)
@@ -42,6 +42,15 @@ def galaxy_root_option():
)


def galaxy_sqlite_database_option():
return click.option(
"--galaxy_sqlite_database",
callback=get_default_callback(None, resolve_path=True),
type=click.Path(exists=True, file_okay=False, resolve_path=True),
help="Preseeded Galaxy sqlite database to target.",
)


def galaxy_cwl_root_option():
return click.option(
"--cwl_galaxy_root",
@@ -521,6 +530,7 @@ def galaxy_config_options():
def galaxy_target_options():
return _compose(
galaxy_root_option(),
galaxy_sqlite_database_option(),
install_galaxy_option(),
no_cache_galaxy_option(),
no_cleanup_option(),

0 comments on commit c23569f

Please sign in to comment.