def cli(ctx, path, template=None, **kwds): """(Experimental) Initialize a new tool project. This is only a proof-of-concept demo right now. """ if template is None: warn("Creating empty project, this function doesn't do much yet.") if not os.path.exists(path): os.makedirs(path) if template is None: return tempdir = tempfile.mkdtemp() try: untar_args = UNTAR_ARGS % (tempdir) untar_to(DOWNLOAD_URL, tempdir, untar_args) template_dir = os.path.join(tempdir, template) shell("ls '%s'" % (template_dir)) shell("mv '%s'/* '%s'" % (template_dir, path)) dot_files = [os.path.join(template_dir, f) for f in os.listdir(template_dir) if f.startswith(".")] if len(dot_files) > 0: dot_files_quoted = "'" + "' '".join(dot_files) + "'" shell("mv %s '%s'" % (dot_files_quoted, path)) finally: shutil.rmtree(tempdir)
def _install_galaxy_via_download(ctx, galaxy_root, env, kwds): branch = _galaxy_branch(kwds) untar_to("https://codeload.github.com/galaxyproject/galaxy/tar.gz/" + branch, tar_args=['-xvzf', '-', 'galaxy-' + branch], dest_dir=galaxy_root) _install_with_command(ctx, galaxy_root, env, kwds)
def cli(ctx, path, template=None, **kwds): """(Experimental) Initialize a new tool project. This is only a proof-of-concept demo right now. """ if template is None: warn("Creating empty project, this function doesn't do much yet.") if not os.path.exists(path): os.makedirs(path) if template is None: return tempdir = tempfile.mkdtemp() try: untar_args = UNTAR_ARGS % (tempdir) untar_to(DOWNLOAD_URL, tempdir, untar_args) template_dir = os.path.join(tempdir, template) shell("ls '%s'" % (template_dir)) shell("mv '%s'/* '%s'" % (template_dir, path)) dot_files = [ os.path.join(template_dir, f) for f in os.listdir(template_dir) if f.startswith(".") ] if len(dot_files) > 0: dot_files_quoted = "'" + "' '".join(dot_files) + "'" shell("mv %s '%s'" % (dot_files_quoted, path)) finally: shutil.rmtree(tempdir)
def _try_download_hub(planemo_hub_path): link = _hub_link() # Strip URL base and .tgz at the end. basename = link.split("/")[-1].rsplit(".", 1)[0] untar_to(link, tar_args="-zxvf - %s/bin/hub -O > '%s'" % (basename, planemo_hub_path)) communicate(["chmod", "+x", planemo_hub_path])
def download_tar(tsi, repo_id, destination, to_directory): base_url = tsi.base_url if not base_url.endswith("/"): base_url += "/" download_url = REPOSITORY_DOWNLOAD_TEMPLATE % (base_url, repo_id) if to_directory: untar_args = "-xzf - -C %s --strip-components 1" % destination else: untar_args = None untar_to(download_url, destination, untar_args)
def download_tar(tsi, repo_id, destination, to_directory): base_url = tsi.base_url if not base_url.endswith("/"): base_url += "/" download_url = REPOSITORY_DOWNLOAD_TEMPLATE % (base_url, repo_id) if to_directory: tar_args = ['-xzf', '-', '--strip-components=1'] untar_to(download_url, tar_args=tar_args, dest_dir=destination) else: untar_to(download_url, path=destination)
def cli(ctx, path, template=None, **kwds): """Initialize a new tool project (demo only right now). """ if template is None: warn("Creating empty project, this function doesn't do much yet.") if not os.path.exists(path): os.makedirs(path) if template is None: return tempdir = tempfile.mkdtemp() try: untar_args = UNTAR_ARGS % (tempdir) untar_to(DOWNLOAD_URL, tempdir, untar_args) shell("ls '%s'" % (tempdir)) shell("mv '%s/%s'/* '%s'" % (tempdir, template, path)) finally: shutil.rmtree(tempdir)
def download_tarball(ctx, tsi, path, **kwds): destination = kwds.get('destination', 'shed_download.tar.gz') repo_id = find_repository_id(ctx, tsi, path, **kwds) base_url = tsi.base_url if not base_url.endswith("/"): base_url += "/" download_url = REPOSITORY_DOWNLOAD_TEMPLATE % (base_url, repo_id) to_directory = not destination.endswith("gz") if to_directory: untar_args = "-xzf - -C %s --strip-components 1" % destination else: untar_args = None untar_to(download_url, destination, untar_args) if to_directory: clean = kwds.get("clean", False) if clean: archival_file = os.path.join(destination, ".hg_archival.txt") if os.path.exists(archival_file): os.remove(archival_file)
def cli(ctx, path, template=None, **kwds): """(Experimental) Initialize a new tool project. This is only a proof-of-concept demo right now. """ if template is None: warn("Creating empty project, this function doesn't do much yet.") if not os.path.exists(path): os.makedirs(path) if template is None: return tempdir = tempfile.mkdtemp() try: untar_args = UNTAR_ARGS % (tempdir) untar_to(DOWNLOAD_URL, tempdir, untar_args) template_dir = os.path.join(tempdir, template) for entry in os.listdir(template_dir): shutil.move(os.path.join(template_dir, entry), path) finally: shutil.rmtree(tempdir)
def _try_download_hub(planemo_hub_path): link = _hub_link() # Strip URL base and .tgz at the end. basename = link.split("/")[-1].rsplit(".", 1)[0] untar_to(link, tar_args="-Ozxvf - %s/bin/hub > '%s'" % (basename, planemo_hub_path)) communicate(["chmod", "+x", planemo_hub_path])