Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from lbdreyer/update_fetch_sources
Browse files Browse the repository at this point in the history
Update fetch sources to match new naming structure of git sources.
  • Loading branch information
bjlittle authored Nov 4, 2016
2 parents 314ff02 + ac4c8a4 commit ead0e7c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
16 changes: 11 additions & 5 deletions centrally_managed_conda/fetch_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import argparse
import os.path
from os.path import join, abspath, expanduser, isdir, isfile
from os.path import join, abspath, expanduser, isdir, isfile, normpath
import sys

from conda_build import external
Expand Down Expand Up @@ -47,11 +47,17 @@ def git_source(meta, recipe_dir, GIT_CACHE):
git_url = meta['git_url']
if git_url.startswith('.'):
# It's a relative path from the conda recipe
os.chdir(recipe_dir)
git_dn = abspath(expanduser(git_url))
git_dn = "_".join(git_dn.split(os.path.sep)[1:])
git_url = abspath(normpath(os.path.join(recipe_dir, git_url)))
if sys.platform == 'win32':
git_dn = git_url.replace(':', '_')
else:
git_dn = git_url[1:]
else:
git_dn = git_url.split(':')[-1].replace('/', '_')
git_dn = git_url.split('://')[-1].replace('/', os.sep)
if git_dn.startswith(os.sep):
git_dn = git_dn[1:]
git_dn = git_dn.replace(':', '_')

cache_repo = cache_repo_arg = join(GIT_CACHE, git_dn)

# update (or create) the cache repo
Expand Down
9 changes: 5 additions & 4 deletions centrally_managed_conda/tests/unit/test_compose_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ def test(self):
out = subprocess.check_output([sys.executable, '-m', 'centrally_managed_conda.compose_recipes',
'--output-dir={}'.format(output),
channel1, channel2])
self.assertEqual(out.strip().decode('utf-8'),
'\n'.join(['Copying channel1/a',
'Copying channel1/b',
'Copying channel2/c']))

self.assertEqual(set(out.strip().decode('utf-8').splitlines()),
set(['Copying channel1/a',
'Copying channel1/b',
'Copying channel2/c']))
if out.strip():
print(out.decode('utf-8'))
# Check they are all there, except for a2.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description='Tools and documentation for deploying centrally managed conda environments.',
author='Phil Elson',
author_email='[email protected]',
url='https://github.com/pelson/centrally-managed-conda',
url='https://github.com/SciTools-incubator/centrally-managed-conda',
packages=['centrally_managed_conda'],
)

0 comments on commit ead0e7c

Please sign in to comment.