Permalink
Browse files

Rename project to mayo

  • Loading branch information...
1 parent 189f81d commit 717142e1b88b331722b3163ad0161bff6baa7c94 @mwilliamson committed Mar 18, 2013
View
@@ -1,26 +1,26 @@
-# Blah: Download source control URIs
+# Mayo: Download source control URIs
-The main use of Blah is being able to download repositories from a URI that
+The main use of Mayo is being able to download repositories from a URI that
specifies what version control system (VCS) is being used:
```python
-import blah
+import mayo
-blah.fetch("git+https://github.com/mwilliamson/blah.git", "/tmp/blah")
-print open("/tmp/blah/README.md").read()
+mayo.fetch("git+https://github.com/mwilliamson/mayo.git", "/tmp/mayo")
+print open("/tmp/mayo/README.md").read()
```
-Blah can also be used as a script:
+Mayo can also be used as a script:
```
-blah fetch git+https://github.com/mwilliamson/blah.git /tmp/blah
+mayo fetch git+https://github.com/mwilliamson/mayo.git /tmp/mayo
```
Specific commits can be selected by appending a hash to the URI, followed by
the name of the commit:
```python
-blah.fetch("git+https://github.com/mwilliamson/blah.git#74d69b4", "/tmp/blah")
+mayo.fetch("git+https://github.com/mwilliamson/mayo.git#74d69b4", "/tmp/mayo")
```
At the moment, git and hg URIs are supported.
View
@@ -1,13 +0,0 @@
-from blah.fetcher import fetch, archive
-from blah.repositories import find_repository, repository_at
-from blah.errors import UnrecognisedSourceControlSystem
-from blah.systems import is_source_control_uri
-
-__all__ = [
- "fetch",
- "archive",
- "find_repository",
- "repository_at",
- "is_source_control_uri",
- "UnrecognisedSourceControlSystem"
-]
View
@@ -1,5 +0,0 @@
-class BlahUserError(RuntimeError):
- pass
-
-class UnrecognisedSourceControlSystem(BlahUserError):
- pass
View
@@ -1,7 +1,7 @@
.PHONY: test upload clean bootstrap setup
test:
- HGUSER=blah-test nosetests -m'^$$' `find tests -name '*.py'`
+ HGUSER=blah-test _virtualenv/bin/nosetests -m'^$$' `find tests -name '*.py'`
upload: setup
python setup.py sdist upload
View
@@ -0,0 +1,13 @@
+from .fetcher import fetch, archive
+from .repositories import find_repository, repository_at
+from .errors import UnrecognisedSourceControlSystem
+from .systems import is_source_control_uri
+
+__all__ = [
+ "fetch",
+ "archive",
+ "find_repository",
+ "repository_at",
+ "is_source_control_uri",
+ "UnrecognisedSourceControlSystem"
+]
@@ -3,4 +3,4 @@
def cache_root():
xdg_cache_home = os.environ.get("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
- return os.environ.get("BLAH_CACHE_DIR", os.path.join(xdg_cache_home, "blah"))
+ return os.environ.get("MAYO_CACHE_DIR", os.path.join(xdg_cache_home, "mayo"))
@@ -1,17 +1,17 @@
import os
import argparse
-import blah.repositories
-import blah.fetcher
-import blah.errors
+import mayo.repositories
+import mayo.fetcher
+import mayo.errors
class WhatIsThisCommand(object):
def create_parser(self, subparser):
subparser.add_argument("directory", nargs="?")
def execute(self, args):
directory = args.directory if args.directory is not None else os.getcwd()
- repository = blah.repositories.find_repository(directory)
+ repository = mayo.repositories.find_repository(directory)
if repository is None:
print "Could not find source control repository"
else:
@@ -25,8 +25,8 @@ def create_parser(self, subparser):
def execute(self, args):
try:
- blah.fetcher.fetch(args.repository_uri, args.local_path, args.use_cache)
- except (blah.errors.BlahUserError, blah.util.NoSuchCommandError) as error:
+ mayo.fetcher.fetch(args.repository_uri, args.local_path, args.use_cache)
+ except (mayo.errors.MayoUserError, mayo.util.NoSuchCommandError) as error:
print "fetch failed: {0}".format(error.message)
exit(-1)
@@ -37,8 +37,8 @@ def create_parser(self, subparser):
def execute(self, args):
try:
- blah.fetcher.archive(args.repository_uri, args.local_path)
- except (blah.errors.BlahUserError, blah.util.NoSuchCommandError) as error:
+ mayo.fetcher.archive(args.repository_uri, args.local_path)
+ except (mayo.errors.MayoUserError, mayo.util.NoSuchCommandError) as error:
print "archive failed: {0}".format(error.message)
exit(-1)
View
@@ -0,0 +1,5 @@
+class MayoUserError(RuntimeError):
+ pass
+
+class UnrecognisedSourceControlSystem(MayoUserError):
+ pass
@@ -4,17 +4,17 @@
import catchy
-import blah.systems
-import blah.uri_parser
-import blah.errors
-import blah.caching
+import mayo.systems
+import mayo.uri_parser
+import mayo.errors
+import mayo.caching
def archive(uri_str, local_path):
uri_hash = _sha1(uri_str)
- cacher = catchy.DirectoryCacher(os.path.join(blah.caching.cache_root(), "archive"))
+ cacher = catchy.DirectoryCacher(os.path.join(mayo.caching.cache_root(), "archive"))
cache_result = cacher.fetch(uri_hash, local_path)
if not cache_result.cache_hit:
- uri = blah.uri_parser.parse(uri_str)
+ uri = mayo.uri_parser.parse(uri_str)
vcs, local_repo = _fetch(uri_str, local_path)
is_fixed_revision = local_repo.is_fixed_revision(uri.revision)
@@ -32,9 +32,9 @@ def fetch(*args, **kwargs):
def _fetch(uri_str, local_path, use_cache=False, systems=None):
if systems is None:
- systems = blah.systems.all_systems
+ systems = mayo.systems.all_systems
- uri = blah.uri_parser.parse(uri_str)
+ uri = mayo.uri_parser.parse(uri_str)
vcs = _find_vcs(uri, systems)
if use_cache and getattr(vcs, "supports_caching", False):
@@ -50,7 +50,7 @@ def _find_vcs(uri, systems):
return vcs
message = "Source control system not recognised: {0}".format(uri.vcs)
- raise blah.errors.UnrecognisedSourceControlSystem(message)
+ raise mayo.errors.UnrecognisedSourceControlSystem(message)
def _fetch_all_revisions(uri, local_path, vcs):
if os.path.exists(local_path):
@@ -68,10 +68,10 @@ def _update(repository_uri, local_path, vcs):
vcs_directory = os.path.join(local_path, vcs.directory_name)
if not os.path.isdir(local_path):
message = "Checkout path already exists, and is not directory: {0}".format(local_path)
- raise blah.errors.BlahUserError(message)
+ raise mayo.errors.MayoUserError(message)
elif not os.path.isdir(vcs_directory):
message = "{0} already exists and is not a {1} repository".format(local_path, vcs.name)
- raise blah.errors.BlahUserError(message)
+ raise mayo.errors.MayoUserError(message)
else:
local_repo = vcs.local_repo(local_path)
current_remote_uri = local_repo.remote_repo_uri()
@@ -81,5 +81,5 @@ def _update(repository_uri, local_path, vcs):
else:
message = "{0} is existing checkout of different repository: {1}" \
.format(local_path, current_remote_uri)
- raise blah.errors.BlahUserError(message)
+ raise mayo.errors.MayoUserError(message)
File renamed without changes.
@@ -2,8 +2,8 @@
import os.path
import hashlib
-from blah.util import run
-import blah.caching
+from .util import run
+import mayo.caching
class Git(object):
@@ -34,7 +34,7 @@ def local_repo(self, working_directory):
return GitRepository(working_directory)
def _update_cache(self, repository_uri):
- cache_root = blah.caching.cache_root()
+ cache_root = mayo.caching.cache_root()
repo_hash = hashlib.sha1(repository_uri).hexdigest()
cache_dir = os.path.join(cache_root, repo_hash)
@@ -1,4 +1,4 @@
-from blah.util import quiet_check_call, quiet_check_output
+from .util import quiet_check_call, quiet_check_output
class Hg(object):
name = "hg"
@@ -1,7 +1,7 @@
import os
-from blah import systems
-from blah.files import parent
+from . import systems
+from .files import parent
def repository_at(working_directory):
directory = os.path.abspath(working_directory)
@@ -1,14 +1,14 @@
-from blah.git import Git
-from blah.hg import Hg
-import blah.uri_parser
+from .git import Git
+from .hg import Hg
+from .uri_parser import parse as parse_uri
all_systems = [
Git(),
Hg()
]
def is_source_control_uri(uri):
- parsed_uri = blah.uri_parser.parse(uri)
+ parsed_uri = parse_uri(uri)
return parsed_uri.vcs is not None and _is_recognised_prefix(parsed_uri.vcs)
def _is_recognised_prefix(prefix):
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@
import argparse
-from blah.commands import commands
+from mayo.commands import commands
def main():
parser = argparse.ArgumentParser()
View
@@ -7,13 +7,13 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
- name='blah',
+ name='mayo',
version='0.1.12',
description='Thin wrapper around source control systems',
long_description=read("README"),
author='Michael Williamson',
- url='http://github.com/mwilliamson/blah',
- scripts=["scripts/blah"],
- packages=['blah'],
+ url='http://github.com/mwilliamson/mayo',
+ scripts=["scripts/mayo"],
+ packages=['mayo'],
install_requires=["argparse==1.2.1", "catchy>=0.1.0,<0.2"],
)
View
@@ -4,11 +4,11 @@
from nose.tools import istest, assert_equal, assert_false
-from blah.fetcher import fetch, archive
-from blah.files import mkdir_p, temporary_directory, write_file, read_file
-from blah import UnrecognisedSourceControlSystem
-from blah.errors import BlahUserError
-from blah.systems import all_systems
+from mayo.fetcher import fetch, archive
+from mayo.files import mkdir_p, temporary_directory, write_file, read_file
+from mayo import UnrecognisedSourceControlSystem
+from mayo.errors import MayoUserError
+from mayo.systems import all_systems
from test_repos import temporary_hg_repo, temporary_git_repo, add_commit_to_repo, tag_git_repo
import test_repos
@@ -182,7 +182,7 @@ def error_is_raised_if_target_is_file():
with temporary_git_repo() as git_repo:
original_uri = "git+file://" + git_repo.working_directory
assert_raises_message(
- BlahUserError,
+ MayoUserError,
"Checkout path already exists, and is not directory: {0}".format(target),
lambda: fetch(original_uri, target)
)
@@ -193,7 +193,7 @@ def git_fetch_raises_error_if_target_is_not_git_repository():
with temporary_git_repo() as git_repo:
original_uri = "git+file://" + git_repo.working_directory
assert_raises_message(
- BlahUserError,
+ MayoUserError,
"{0} already exists and is not a git repository".format(target),
lambda: fetch(original_uri, target)
)
@@ -205,7 +205,7 @@ def git_fetch_raises_error_if_target_is_checkout_of_different_repository():
with temporary_git_repo() as second_repo:
fetch("git+file://" + first_repo.working_directory, target)
assert_raises_message(
- BlahUserError,
+ MayoUserError,
"{0} is existing checkout of different repository: file://{1}"
.format(target, first_repo.working_directory),
lambda: fetch("git+file://" + second_repo.working_directory, target)
@@ -218,7 +218,7 @@ def hg_fetch_raises_error_if_target_is_checkout_of_different_repository():
with temporary_hg_repo() as second_repo:
fetch("hg+file://" + first_repo.working_directory, target)
assert_raises_message(
- BlahUserError,
+ MayoUserError,
"{0} is existing checkout of different repository: file://{1}"
.format(target, first_repo.working_directory),
lambda: fetch("hg+file://" + second_repo.working_directory, target)
@@ -2,8 +2,8 @@
from nose.tools import istest, assert_equal
-from blah.repositories import repository_at, find_repository
-from blah.files import mkdir_p, temporary_directory
+from mayo.repositories import repository_at, find_repository
+from mayo.files import mkdir_p, temporary_directory
@istest
def none_is_returned_if_there_is_no_repository():
View
@@ -1,6 +1,6 @@
from nose.tools import istest, assert_true, assert_false
-import blah.systems
+import mayo.systems
@istest
def uri_is_recognised_if_it_has_known_source_control_prefix():
@@ -16,7 +16,7 @@ def uri_is_not_recognised_if_prefix_is_not_known():
_assert_is_not_source_control_uri("local+file:///tmp/blah")
def _assert_is_source_control_uri(uri):
- assert_true(blah.systems.is_source_control_uri(uri))
+ assert_true(mayo.systems.is_source_control_uri(uri))
def _assert_is_not_source_control_uri(uri):
- assert_false(blah.systems.is_source_control_uri(uri))
+ assert_false(mayo.systems.is_source_control_uri(uri))
View
@@ -2,9 +2,9 @@
import subprocess
from contextlib import contextmanager
-from blah.git import Git
-from blah.hg import Hg
-from blah.files import temporary_directory, write_file
+from mayo.git import Git
+from mayo.hg import Hg
+from mayo.files import temporary_directory, write_file
def create_repo(vcs_name, path):
return {
@@ -1,6 +1,6 @@
from nose.tools import istest, assert_equal
-from blah.uri_parser import parse
+from mayo.uri_parser import parse
@istest
def vcs_is_none_if_plus_doesnt_occur_in_uri():
Oops, something went wrong.

0 comments on commit 717142e

Please sign in to comment.