From 5a45ffe386b827bd7850117a980912305ad096f1 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sun, 27 Jan 2019 18:28:01 -0500 Subject: [PATCH 1/8] Use datafiles for serialization --- .appveyor.yml | 2 - .mypy.ini | 2 + .pylint.ini | 6 +- .travis.yml | 1 - CHANGELOG.md | 5 + gitman/commands.py | 4 +- gitman/common.py | 3 +- gitman/git.py | 2 +- gitman/models/config.py | 39 +++---- gitman/models/group.py | 24 ++-- gitman/models/source.py | 71 +++++------- gitman/settings.py | 8 +- gitman/shell.py | 2 +- gitman/tests/conftest.py | 11 +- gitman/tests/test_models_source.py | 34 +++--- poetry.lock | 179 +++++++++++++++++------------ pyproject.toml | 7 +- tests/conftest.py | 4 +- tests/test_api.py | 125 ++++++++++++-------- 19 files changed, 301 insertions(+), 228 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index bcdfffef..845b62a5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,8 +2,6 @@ environment: global: RANDOM_SEED: 0 matrix: - - PYTHON_MAJOR: 3 - PYTHON_MINOR: 6 - PYTHON_MAJOR: 3 PYTHON_MINOR: 7 - PYTHON_MAJOR: 3 diff --git a/.mypy.ini b/.mypy.ini index 264105fe..9baabc5f 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -5,3 +5,5 @@ no_implicit_optional = true check_untyped_defs = true cache_dir = .cache/mypy/ + +plugins = datafiles.plugins:mypy diff --git a/.pylint.ini b/.pylint.ini index 576479ae..7ed3ae20 100644 --- a/.pylint.ini +++ b/.pylint.ini @@ -127,7 +127,11 @@ disable= redefined-builtin, too-many-public-methods, bad-continuation, - subprocess-run-check, + no-member, + not-an-iterable, + unsupported-assignment-operation, + unsubscriptable-object, + too-many-instance-attributes, # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/.travis.yml b/.travis.yml index c28850b9..a599a44c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ dist: xenial language: python python: - - 3.6 - 3.7 - 3.8 diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3d2e01..9f5ef1e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.0 (alpha) + +- **BREAKING**: Dropped support for Python 3.6. +- Switched to `datafiles` for YAML serialization. + # 1.8 (beta) - Added support Python 3.8. diff --git a/gitman/commands.py b/gitman/commands.py index fe8b16ca..20325dcc 100644 --- a/gitman/commands.py +++ b/gitman/commands.py @@ -34,14 +34,14 @@ def init(): else: config = Config() source = Source( - 'git', + type='git', name="sample_dependency", repo="https://github.com/githubtraining/hellogitworld", ) config.sources.append(source) source = source.lock(rev="ebbbf773431ba07510251bb03f9525c7bab2b13a") config.sources_locked.append(source) - config.save() + config.datafile.save() msg = "Created sample config file: {}".format(config.path) common.show(msg, color='success') diff --git a/gitman/common.py b/gitman/common.py index 594779b8..91318066 100644 --- a/gitman/common.py +++ b/gitman/common.py @@ -79,8 +79,9 @@ def configure_logging(count=0): verbose_format = settings.VERBOSE2_LOGGING_FORMAT # Set a custom formatter + log.reset() # TODO: this shouldn't be necessary log.init(level=level) - log.silence('yorm', allow_warning=True) + log.silence('datafiles', allow_warning=True) logging.captureWarnings(True) formatter = WarningFormatter( default_format, verbose_format, datefmt=settings.LOGGING_DATEFMT diff --git a/gitman/git.py b/gitman/git.py index 1f1e6d18..491d1ba7 100644 --- a/gitman/git.py +++ b/gitman/git.py @@ -43,7 +43,7 @@ def clone(type, repo, path, *, cache=settings.CACHE, sparse_paths=None, rev=None if not settings.CACHE_DISABLE and not os.path.isdir(reference): git('clone', '--mirror', repo, reference) - if sparse_paths: + if sparse_paths and sparse_paths[0]: os.mkdir(normpath) git('-C', normpath, 'init') git('-C', normpath, 'config', 'core.sparseCheckout', 'true') diff --git a/gitman/models/config.py b/gitman/models/config.py index 4cc55bef..164df90b 100644 --- a/gitman/models/config.py +++ b/gitman/models/config.py @@ -1,33 +1,29 @@ import os -from typing import List +from typing import List, Optional import log -import yorm -from yorm.types import SortedList, String +from datafiles import datafile, field from .. import common, exceptions, shell from .group import Group from .source import Source -@yorm.attr(location=String) -@yorm.attr(sources=SortedList.of_type(Source)) -@yorm.attr(sources_locked=SortedList.of_type(Source)) -@yorm.attr(groups=SortedList.of_type(Group)) -@yorm.sync("{self.root}/{self.filename}", auto_save=False) -class Config(yorm.ModelMixin): +@datafile("{self.root}/{self.filename}", defaults=True, manual=True) +class Config: """Specifies all dependencies for a project.""" - LOG = "gitman.log" + root: Optional[str] = None + filename: str = "gitman.yml" - def __init__(self, root=None, filename="gitman.yml", location="gitman_sources"): - super().__init__() - self.root = root or os.getcwd() - self.filename = filename - self.location = location - self.sources: List[Source] = [] - self.sources_locked: List[Source] = [] - self.groups: List[Group] = [] + location: str = "gitman_sources" + sources: List[Source] = field(default_factory=list) + sources_locked: List[Source] = field(default_factory=list) + groups: List[Group] = field(default_factory=list) + + def __post_init__(self): + if self.root is None: + self.root = os.getcwd() def _on_post_load(self): for source in self.sources: @@ -49,6 +45,7 @@ def _on_post_load(self): @property def config_path(self): """Get the full path to the config file.""" + assert self.root return os.path.normpath(os.path.join(self.root, self.filename)) path = config_path @@ -56,11 +53,12 @@ def config_path(self): @property def log_path(self): """Get the full path to the log file.""" - return os.path.normpath(os.path.join(self.location_path, self.LOG)) + return os.path.normpath(os.path.join(self.location_path, "gitman.log")) @property def location_path(self): """Get the full path to the dependency storage location.""" + assert self.root return os.path.normpath(os.path.join(self.root, self.location)) def get_path(self, name=None): @@ -204,7 +202,7 @@ def lock_dependencies(self, *names, obey_existing=True, skip_changes=False): shell.cd(self.location_path, _show=False) if count: - self.save() + self.datafile.save() common.dedent() @@ -240,6 +238,7 @@ def get_top_level_dependencies(self): for source in self.sources: + assert source.name yield os.path.join(self.location_path, source.name) shell.cd(self.location_path, _show=False) diff --git a/gitman/models/group.py b/gitman/models/group.py index 8340810e..2e133902 100644 --- a/gitman/models/group.py +++ b/gitman/models/group.py @@ -1,23 +1,21 @@ -import yorm -from yorm.types import AttributeDictionary, List, String +from dataclasses import dataclass +from typing import List from .. import exceptions -@yorm.attr(name=String) -@yorm.attr(members=List.of_type(String)) -class Group(AttributeDictionary): +@dataclass +class Group: """A group with sources.""" - def __init__(self, name, members): + name: str + members: List[str] - super().__init__() - self.name = name - self.members = members or [] - - for key in ['name', 'members']: - if not self[key]: - msg = "'{}' required for {}".format(key, repr(self)) + def __post_init__(self): + # TODO: Remove this? + for name in ['name', 'members']: + if not getattr(self, name): + msg = "'{}' required for {}".format(name, repr(self)) raise exceptions.InvalidConfig(msg) def __repr__(self): diff --git a/gitman/models/source.py b/gitman/models/source.py index 5244f4e7..8e9c7de2 100644 --- a/gitman/models/source.py +++ b/gitman/models/source.py @@ -1,51 +1,39 @@ import os +from dataclasses import dataclass, field +from typing import List, Optional import log -import yorm -from yorm.types import AttributeDictionary, List, NullableString, String from .. import common, exceptions, git, shell -@yorm.attr(name=String) -@yorm.attr(type=String) -@yorm.attr(repo=String) -@yorm.attr(sparse_paths=List.of_type(String)) -@yorm.attr(rev=String) -@yorm.attr(link=NullableString) -@yorm.attr(scripts=List.of_type(String)) -class Source(AttributeDictionary): +@dataclass +class Source: """A dictionary of `git` and `ln` arguments.""" + name: Optional[str] + type: str + repo: str + sparse_paths: List[str] = field(default_factory=list) + rev: str = 'master' + link: Optional[str] = None + scripts: List[str] = field(default_factory=list) + DIRTY = '' UNKNOWN = '' - def __init__( - self, - type, - repo, - name=None, - rev='master', - link=None, - scripts=None, - sparse_paths=None, - ): + def __post_init__(self): + if self.name is None: + self.name = self._infer_name(self.repo) - super().__init__() - self.type = type or 'git' - self.repo = repo - self.name = self._infer_name(repo) if name is None else name - self.rev = rev - self.link = link - self.scripts = scripts or [] - self.sparse_paths = sparse_paths or [] - - for key in ['name', 'repo', 'rev']: - if not self[key]: - msg = "'{}' required for {}".format(key, repr(self)) + # TODO: Remove this? + for name in ['name', 'repo', 'rev']: + if not getattr(self, name): + msg = "'{}' required for {}".format(name, repr(self)) raise exceptions.InvalidConfig(msg) def _on_post_load(self): + # TODO: Remove this? self.type = self.type or 'git' def __repr__(self): @@ -80,6 +68,7 @@ def update_files( log.info("Updating source files...") # Clone the repository if needed + assert self.name if not os.path.exists(self.name): git.clone( self.type, @@ -178,7 +167,7 @@ def run_scripts(self, force=False): raise self._invalid_repository # Check for scripts - if not self.scripts: + if not self.scripts or not self.scripts[0]: common.show("(no scripts to run)", color='shell_info') common.newline() return @@ -201,6 +190,7 @@ def run_scripts(self, force=False): def identify(self, allow_dirty=True, allow_missing=True, skip_changes=False): """Get the path and current repository URL and hash.""" + assert self.name if os.path.isdir(self.name): shell.cd(self.name) @@ -257,18 +247,19 @@ def lock(self, rev=None, allow_dirty=False, skip_changes=False): return None source = self.__class__( - self.type, - self.repo, - self.name, - rev, - self.link, - self.scripts, - self.sparse_paths, + type=self.type, + repo=self.repo, + name=self.name, + rev=rev, + link=self.link, + scripts=self.scripts, + sparse_paths=self.sparse_paths, ) return source @property def _invalid_repository(self): + assert self.name path = os.path.join(os.getcwd(), self.name) msg = """ diff --git a/gitman/settings.py b/gitman/settings.py index bedce65e..58426f85 100644 --- a/gitman/settings.py +++ b/gitman/settings.py @@ -2,9 +2,13 @@ import os +import datafiles import log +# Serialization settings +datafiles.settings.INDENT_YAML_BLOCKS = False + # Cache settings CACHE = os.path.expanduser(os.getenv('GITMAN_CACHE', "~/.gitcache")) CACHE_DISABLE = bool(os.getenv('GITMAN_CACHE_DISABLE')) @@ -19,7 +23,3 @@ VERBOSE_LOGGING_LEVEL = log.INFO VERBOSE2_LOGGING_LEVEL = log.DEBUG LOGGING_DATEFMT = "%Y-%m-%d %H:%M" - -# 3rd party settings -YORM_LOGGING_LEVEL = log.WARNING -SH_LOGGING_LEVEL = log.WARNING diff --git a/gitman/shell.py b/gitman/shell.py index 211acb34..1554aca9 100644 --- a/gitman/shell.py +++ b/gitman/shell.py @@ -26,7 +26,7 @@ def call(name, *args, _show=True, _shell=False, _ignore=False): """ program = show(name, *args, stdout=_show) - command = subprocess.run( + command = subprocess.run( # pylint: disable=subprocess-run-check name if _shell else [name, *args], universal_newlines=True, stdout=subprocess.PIPE, diff --git a/gitman/tests/conftest.py b/gitman/tests/conftest.py index af7a8594..bd79934c 100644 --- a/gitman/tests/conftest.py +++ b/gitman/tests/conftest.py @@ -2,8 +2,9 @@ import os +import datafiles +import log import pytest -import yorm ENV = 'TEST_INTEGRATION' # environment variable to enable integration tests @@ -16,14 +17,16 @@ def pytest_configure(config): terminal = config.pluginmanager.getplugin('terminal') terminal.TerminalReporter.showfspath = False + log.silence('gitman.shell', allow_info=True) + log.silence('datafiles', allow_warning=True) def pytest_runtest_setup(item): - """Disable YORM file storage during unit tests.""" + """Disable file storage during unit tests.""" if 'integration' in item.keywords: if not os.getenv(ENV): pytest.skip(REASON) else: - yorm.settings.fake = False + datafiles.settings.HOOKS_ENABLED = True else: - yorm.settings.fake = True + datafiles.settings.HOOKS_ENABLED = False diff --git a/gitman/tests/test_models_source.py b/gitman/tests/test_models_source.py index df9aa6ab..80de908a 100644 --- a/gitman/tests/test_models_source.py +++ b/gitman/tests/test_models_source.py @@ -10,13 +10,13 @@ @pytest.fixture def source(): - return Source('git', 'repo', 'name', rev='rev', link='link') + return Source(type='git', repo='repo', name='name', rev='rev', link='link') class TestSource: def test_init_defaults(self): """Verify a source has a default revision.""" - source = Source('git', 'http://example.com/foo/bar.git') + source = Source(type='git', repo='http://example.com/foo/bar.git', name=None) assert 'http://example.com/foo/bar.git' == source.repo assert 'bar' == source.name @@ -25,24 +25,28 @@ def test_init_defaults(self): def test_init_rev(self): """Verify the revision can be customized.""" - source = Source('git', 'http://mock.git', 'mock_name', 'v1.0') + source = Source( + type='git', repo='http://mock.git', name='mock_name', rev='v1.0' + ) assert 'v1.0' == source.rev def test_init_link(self): """Verify the link can be set.""" - source = Source('git', 'http://mock.git', 'mock_name', link='mock/link') + source = Source( + type='git', repo='http://mock.git', name='mock_name', link='mock/link' + ) assert 'mock/link' == source.link def test_init_error(self): """Verify the repository, name, and rev are required.""" with pytest.raises(ValueError): - Source('git', '', name='mock_name', rev='master') + Source(type='git', repo='', name='mock_name', rev='master') with pytest.raises(ValueError): - Source('git', 'http://mock.git', name='', rev='master') + Source(type='git', repo='http://mock.git', name='', rev='master') with pytest.raises(ValueError): - Source('git', 'http://mock.git', name='mock_name', rev='') + Source(type='git', repo='http://mock.git', name='mock_name', rev='') def test_repr(self, source): """Verify sources can be represented.""" @@ -63,11 +67,11 @@ def test_eq(self, source): def test_lt(self): sources = [ - Source('git', 'http://github.com/owner/123.git'), - Source('git', 'bbb', name='456'), - Source('git', 'ccc', '456'), - Source('git', 'BBB', 'AAA'), - Source('git', 'AAA', 'AAA'), + Source(type='git', repo='http://github.com/owner/123.git', name=None), + Source(type='git', repo='bbb', name='456'), + Source(type='git', repo='ccc', name='456'), + Source(type='git', repo='BBB', name='AAA'), + Source(type='git', repo='AAA', name='AAA'), ] assert sources == sorted(sources) @@ -84,7 +88,7 @@ def test_update_files( self, mock_clone, mock_is_fetch_required, mock_fetch, mock_update ): """Verify update_files when path does not exist""" - source = Source('git', 'repo', 'name', rev='rev', link='link') + source = Source(type='git', repo='repo', name='name', rev='rev', link='link') source.update_files() mock_clone.assert_called_once_with( @@ -108,7 +112,7 @@ def test_update_files_invalid_repo( self, mock_clone, mock_is_fetch_required, mock_fetch, mock_update ): """Verify update_files throws exception on invalid repo when not forced""" - source = Source('git', 'repo', 'name', rev='rev', link='link') + source = Source(type='git', repo='repo', name='name', rev='rev', link='link') with pytest.raises(Exception): source.update_files() @@ -131,7 +135,7 @@ def test_update_files_rebuild_git( self, mock_clone, mock_rebuild, mock_is_fetch_required, mock_fetch, mock_update ): """Verify update_files rebuilds when invalid repo and force is passed""" - source = Source('git', 'repo', 'name', rev='rev', link='link') + source = Source(type='git', repo='repo', name='name', rev='rev', link='link') source.update_files(force=True) mock_clone.assert_not_called() diff --git a/poetry.lock b/poetry.lock index 8fe8de4e..96f8cbe4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -74,6 +74,14 @@ typed-ast = ">=1.4.0" [package.extras] d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] +[[package]] +category = "main" +description = "A decorator for caching properties in classes." +name = "cached-property" +optional = false +python-versions = "*" +version = "1.5.1" + [[package]] category = "dev" description = "Python package for providing Mozilla's CA Bundle." @@ -90,6 +98,14 @@ optional = false python-versions = "*" version = "3.0.4" +[[package]] +category = "main" +description = "property for class methods" +name = "classproperties" +optional = false +python-versions = "*" +version = "0.1.3" + [[package]] category = "dev" description = "Composable command line interface toolkit" @@ -132,6 +148,24 @@ docopt = ">=0.6,<0.7" minilog = "*" requests = ">=2.0,<3.0" +[[package]] +category = "main" +description = "File-based ORM for dataclasses." +name = "datafiles" +optional = false +python-versions = ">=3.7,<4.0" +version = "0.8.1" + +[package.dependencies] +PyYAML = ">=5.2,<6.0" +cached_property = ">=1.5,<2.0" +classproperties = ">=0.1.3,<0.2.0" +minilog = ">=1.4.1,<2.0.0" +parse = ">=1.12,<2.0" +"ruamel.yaml" = ">=0.16.7,<0.17.0" +tomlkit = ">=0.5.3,<0.6.0" +typing-extensions = ">=3.7,<4.0" + [[package]] category = "dev" description = "Python 2.7 backport of the \"dis\" module from Python 3.5+" @@ -353,18 +387,7 @@ description = "parse() is the opposite of format()" name = "parse" optional = false python-versions = "*" -version = "1.8.4" - -[[package]] -category = "main" -description = "Object-oriented filesystem paths" -name = "pathlib2" -optional = false -python-versions = "*" -version = "2.3.5" - -[package.dependencies] -six = "*" +version = "1.15.0" [[package]] category = "dev" @@ -609,14 +632,32 @@ version = "0.14.0" [[package]] category = "main" -description = "Simple, fast, extensible JSON encoder/decoder for Python" -name = "simplejson" +description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" +name = "ruamel.yaml" optional = false -python-versions = ">=2.5, !=3.0.*, !=3.1.*, !=3.2.*" -version = "3.17.0" +python-versions = "*" +version = "0.16.10" + +[package.dependencies] +[package.dependencies."ruamel.yaml.clib"] +python = "<3.9" +version = ">=0.1.2" + +[package.extras] +docs = ["ryd"] +jinja2 = ["ruamel.yaml.jinja2 (>=0.2)"] [[package]] category = "main" +description = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml" +marker = "platform_python_implementation == \"CPython\" and python_version < \"3.9\"" +name = "ruamel.yaml.clib" +optional = false +python-versions = "*" +version = "0.2.0" + +[[package]] +category = "dev" description = "Python 2 and 3 compatibility utilities" name = "six" optional = false @@ -658,6 +699,14 @@ optional = false python-versions = "*" version = "0.10.0" +[[package]] +category = "main" +description = "Style preserving TOML library" +name = "tomlkit" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.5.11" + [[package]] category = "dev" description = "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed." @@ -675,7 +724,7 @@ python-versions = "*" version = "1.4.1" [[package]] -category = "dev" +category = "main" description = "Backported and Experimental Type Hints for Python 3.5+" name = "typing-extensions" optional = false @@ -711,20 +760,6 @@ optional = false python-versions = "*" version = "1.11.2" -[[package]] -category = "main" -description = "Automatic object-YAML mapping for Python." -name = "yorm" -optional = false -python-versions = "*" -version = "1.6.2" - -[package.dependencies] -PyYAML = ">=5.1,<6" -parse = ">=1.8.0,<1.9.0" -pathlib2 = "!=2.3.3" -simplejson = ">=3.8,<4.0" - [[package]] category = "dev" description = "Backport of pathlib-compatible object wrapper for zip files" @@ -739,8 +774,8 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "51b9ba19c3a3234c5fdd2a22e34ccec285ae911bb226fcb462e0efaf792126f4" -python-versions = "^3.6" +content-hash = "ab7751bbd889c75a72bee782fc9e7deddc30cf82de28121c550e6a5ae5c12b49" +python-versions = "^3.7" [metadata.files] altgraph = [ @@ -767,6 +802,10 @@ black = [ {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, ] +cached-property = [ + {file = "cached-property-1.5.1.tar.gz", hash = "sha256:9217a59f14a5682da7c4b8829deadbfc194ac22e9908ccf7c8820234e80a1504"}, + {file = "cached_property-1.5.1-py2.py3-none-any.whl", hash = "sha256:3a026f1a54135677e7da5ce819b0c690f156f37976f3e30c5430740725203d7f"}, +] certifi = [ {file = "certifi-2019.11.28-py2.py3-none-any.whl", hash = "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3"}, {file = "certifi-2019.11.28.tar.gz", hash = "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"}, @@ -775,6 +814,9 @@ chardet = [ {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, ] +classproperties = [ + {file = "classproperties-0.1.3.tar.gz", hash = "sha256:97d627d11df056838a9426ff15be71a5a365bca456afba8122740c39c527d5b4"}, +] click = [ {file = "click-7.1.1-py2.py3-none-any.whl", hash = "sha256:e345d143d80bf5ee7534056164e5e112ea5e22716bbb1ce727941f4c8b471b9a"}, {file = "click-7.1.1.tar.gz", hash = "sha256:8a18b4ea89d8820c5d0c7da8a64b2c324b4dabb695804dbfea19b9be9d88c0cc"}, @@ -820,6 +862,10 @@ coveragespace = [ {file = "coveragespace-3.1.1-py3-none-any.whl", hash = "sha256:cc62bf4f2feb419032920270a0c16f1a379b80ac9fc6bd3cefce918bfc90ba27"}, {file = "coveragespace-3.1.1.tar.gz", hash = "sha256:c5862d04a91bec32fc7dd8487006922e144280dc05e75b26c38f4ffe4e760fb0"}, ] +datafiles = [ + {file = "datafiles-0.8.1-py3-none-any.whl", hash = "sha256:6acd8c57f3b03adc500712fe81002169138d5be4d0af8d8007aeed4c4312a6c4"}, + {file = "datafiles-0.8.1.tar.gz", hash = "sha256:b1cac290dc4556d61e6358f8ff15634d21287a3e9436ce6dce7a6b38003e7521"}, +] dis3 = [ {file = "dis3-0.1.3-py2-none-any.whl", hash = "sha256:61f7720dd0d8749d23fda3d7227ce74d73da11c2fade993a67ab2f9852451b14"}, {file = "dis3-0.1.3-py3-none-any.whl", hash = "sha256:30b6412d33d738663e8ded781b138f4b01116437f0872aa56aa3adba6aeff218"}, @@ -963,11 +1009,7 @@ packaging = [ {file = "packaging-20.3.tar.gz", hash = "sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3"}, ] parse = [ - {file = "parse-1.8.4.tar.gz", hash = "sha256:c3cdf6206f22aeebfa00e5b954fcfea13d1b2dc271c75806b6025b94fb490939"}, -] -pathlib2 = [ - {file = "pathlib2-2.3.5-py2.py3-none-any.whl", hash = "sha256:0ec8205a157c80d7acc301c0b18fbd5d44fe655968f5d947b6ecef5290fc35db"}, - {file = "pathlib2-2.3.5.tar.gz", hash = "sha256:6cd9a47b597b37cc57de1c05e56fb1a1c9cc9fab04fe78c29acd090418529868"}, + {file = "parse-1.15.0.tar.gz", hash = "sha256:a6d4e2c2f1fbde6717d28084a191a052950f758c0cbd83805357e6575c2b95c0"}, ] pathspec = [ {file = "pathspec-0.7.0-py2.py3-none-any.whl", hash = "sha256:163b0632d4e31cef212976cf57b43d9fd6b0bac6e67c26015d611a647d5e7424"}, @@ -1069,35 +1111,30 @@ rope = [ {file = "rope-0.14.0-py3-none-any.whl", hash = "sha256:f0dcf719b63200d492b85535ebe5ea9b29e0d0b8aebeb87fe03fc1a65924fdaf"}, {file = "rope-0.14.0.tar.gz", hash = "sha256:c5c5a6a87f7b1a2095fb311135e2a3d1f194f5ecb96900fdd0a9100881f48aaf"}, ] -simplejson = [ - {file = "simplejson-3.17.0-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:87d349517b572964350cc1adc5a31b493bbcee284505e81637d0174b2758ba17"}, - {file = "simplejson-3.17.0-cp27-cp27m-win32.whl", hash = "sha256:1d1e929cdd15151f3c0b2efe953b3281b2fd5ad5f234f77aca725f28486466f6"}, - {file = "simplejson-3.17.0-cp27-cp27m-win_amd64.whl", hash = "sha256:1ea59f570b9d4916ae5540a9181f9c978e16863383738b69a70363bc5e63c4cb"}, - {file = "simplejson-3.17.0-cp33-cp33m-win32.whl", hash = "sha256:8027bd5f1e633eb61b8239994e6fc3aba0346e76294beac22a892eb8faa92ba1"}, - {file = "simplejson-3.17.0-cp33-cp33m-win_amd64.whl", hash = "sha256:22a7acb81968a7c64eba7526af2cf566e7e2ded1cb5c83f0906b17ff1540f866"}, - {file = "simplejson-3.17.0-cp34-cp34m-win32.whl", hash = "sha256:17163e643dbf125bb552de17c826b0161c68c970335d270e174363d19e7ea882"}, - {file = "simplejson-3.17.0-cp34-cp34m-win_amd64.whl", hash = "sha256:0fe3994207485efb63d8f10a833ff31236ed27e3b23dadd0bf51c9900313f8f2"}, - {file = "simplejson-3.17.0-cp35-cp35m-win32.whl", hash = "sha256:4cf91aab51b02b3327c9d51897960c554f00891f9b31abd8a2f50fd4a0071ce8"}, - {file = "simplejson-3.17.0-cp35-cp35m-win_amd64.whl", hash = "sha256:fc9051d249dd5512e541f20330a74592f7a65b2d62e18122ca89bf71f94db748"}, - {file = "simplejson-3.17.0-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:86afc5b5cbd42d706efd33f280fec7bd7e2772ef54e3f34cf6b30777cd19a614"}, - {file = "simplejson-3.17.0-cp36-cp36m-win32.whl", hash = "sha256:926bcbef9eb60e798eabda9cd0bbcb0fca70d2779aa0aa56845749d973eb7ad5"}, - {file = "simplejson-3.17.0-cp36-cp36m-win_amd64.whl", hash = "sha256:daaf4d11db982791be74b23ff4729af2c7da79316de0bebf880fa2d60bcc8c5a"}, - {file = "simplejson-3.17.0-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:9a126c3a91df5b1403e965ba63b304a50b53d8efc908a8c71545ed72535374a3"}, - {file = "simplejson-3.17.0-cp37-cp37m-win32.whl", hash = "sha256:fc046afda0ed8f5295212068266c92991ab1f4a50c6a7144b69364bdee4a0159"}, - {file = "simplejson-3.17.0-cp37-cp37m-win_amd64.whl", hash = "sha256:7cce4bac7e0d66f3a080b80212c2238e063211fe327f98d764c6acbc214497fc"}, - {file = "simplejson-3.17.0.tar.gz", hash = "sha256:2b4b2b738b3b99819a17feaf118265d0753d5536049ea570b3c43b51c4701e81"}, - {file = "simplejson-3.17.0.win-amd64-py2.7.exe", hash = "sha256:1d346c2c1d7dd79c118f0cc7ec5a1c4127e0c8ffc83e7b13fc5709ff78c9bb84"}, - {file = "simplejson-3.17.0.win-amd64-py3.3.exe", hash = "sha256:5cfd495527f8b85ce21db806567de52d98f5078a8e9427b18e251c68bd573a26"}, - {file = "simplejson-3.17.0.win-amd64-py3.4.exe", hash = "sha256:8de378d589eccbc75941e480b4d5b4db66f22e4232f87543b136b1f093fff342"}, - {file = "simplejson-3.17.0.win-amd64-py3.5.exe", hash = "sha256:f4b64a1031acf33e281fd9052336d6dad4d35eee3404c95431c8c6bc7a9c0588"}, - {file = "simplejson-3.17.0.win-amd64-py3.6.exe", hash = "sha256:ad8dd3454d0c65c0f92945ac86f7b9efb67fa2040ba1b0189540e984df904378"}, - {file = "simplejson-3.17.0.win-amd64-py3.7.exe", hash = "sha256:229edb079d5dd81bf12da952d4d825bd68d1241381b37d3acf961b384c9934de"}, - {file = "simplejson-3.17.0.win32-py2.7.exe", hash = "sha256:4fd5f79590694ebff8dc980708e1c182d41ce1fda599a12189f0ca96bf41ad70"}, - {file = "simplejson-3.17.0.win32-py3.3.exe", hash = "sha256:d140e9376e7f73c1f9e0a8e3836caf5eec57bbafd99259d56979da05a6356388"}, - {file = "simplejson-3.17.0.win32-py3.4.exe", hash = "sha256:da00675e5e483ead345429d4f1374ab8b949fba4429d60e71ee9d030ced64037"}, - {file = "simplejson-3.17.0.win32-py3.5.exe", hash = "sha256:7739940d68b200877a15a5ff5149e1599737d6dd55e302625650629350466418"}, - {file = "simplejson-3.17.0.win32-py3.6.exe", hash = "sha256:60aad424e47c5803276e332b2a861ed7a0d46560e8af53790c4c4fb3420c26c2"}, - {file = "simplejson-3.17.0.win32-py3.7.exe", hash = "sha256:1fbba86098bbfc1f85c5b69dc9a6d009055104354e0d9880bb00b692e30e0078"}, +"ruamel.yaml" = [ + {file = "ruamel.yaml-0.16.10-py2.py3-none-any.whl", hash = "sha256:0962fd7999e064c4865f96fb1e23079075f4a2a14849bcdc5cdba53a24f9759b"}, + {file = "ruamel.yaml-0.16.10.tar.gz", hash = "sha256:099c644a778bf72ffa00524f78dd0b6476bca94a1da344130f4bf3381ce5b954"}, +] +"ruamel.yaml.clib" = [ + {file = "ruamel.yaml.clib-0.2.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:9c6d040d0396c28d3eaaa6cb20152cb3b2f15adf35a0304f4f40a3cf9f1d2448"}, + {file = "ruamel.yaml.clib-0.2.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:4d55386129291b96483edcb93b381470f7cd69f97585829b048a3d758d31210a"}, + {file = "ruamel.yaml.clib-0.2.0-cp27-cp27m-win32.whl", hash = "sha256:8073c8b92b06b572e4057b583c3d01674ceaf32167801fe545a087d7a1e8bf52"}, + {file = "ruamel.yaml.clib-0.2.0-cp27-cp27m-win_amd64.whl", hash = "sha256:615b0396a7fad02d1f9a0dcf9f01202bf9caefee6265198f252c865f4227fcc6"}, + {file = "ruamel.yaml.clib-0.2.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:a0ff786d2a7dbe55f9544b3f6ebbcc495d7e730df92a08434604f6f470b899c5"}, + {file = "ruamel.yaml.clib-0.2.0-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:ea4362548ee0cbc266949d8a441238d9ad3600ca9910c3fe4e82ee3a50706973"}, + {file = "ruamel.yaml.clib-0.2.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:77556a7aa190be9a2bd83b7ee075d3df5f3c5016d395613671487e79b082d784"}, + {file = "ruamel.yaml.clib-0.2.0-cp35-cp35m-win32.whl", hash = "sha256:392b7c371312abf27fb549ec2d5e0092f7ef6e6c9f767bfb13e83cb903aca0fd"}, + {file = "ruamel.yaml.clib-0.2.0-cp35-cp35m-win_amd64.whl", hash = "sha256:ed5b3698a2bb241b7f5cbbe277eaa7fe48b07a58784fba4f75224fd066d253ad"}, + {file = "ruamel.yaml.clib-0.2.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:7aee724e1ff424757b5bd8f6c5bbdb033a570b2b4683b17ace4dbe61a99a657b"}, + {file = "ruamel.yaml.clib-0.2.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:d0d3ac228c9bbab08134b4004d748cf9f8743504875b3603b3afbb97e3472947"}, + {file = "ruamel.yaml.clib-0.2.0-cp36-cp36m-win32.whl", hash = "sha256:f9dcc1ae73f36e8059589b601e8e4776b9976effd76c21ad6a855a74318efd6e"}, + {file = "ruamel.yaml.clib-0.2.0-cp36-cp36m-win_amd64.whl", hash = "sha256:1e77424825caba5553bbade750cec2277ef130647d685c2b38f68bc03453bac6"}, + {file = "ruamel.yaml.clib-0.2.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d10e9dd744cf85c219bf747c75194b624cc7a94f0c80ead624b06bfa9f61d3bc"}, + {file = "ruamel.yaml.clib-0.2.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:550168c02d8de52ee58c3d8a8193d5a8a9491a5e7b2462d27ac5bf63717574c9"}, + {file = "ruamel.yaml.clib-0.2.0-cp37-cp37m-win32.whl", hash = "sha256:57933a6986a3036257ad7bf283529e7c19c2810ff24c86f4a0cfeb49d2099919"}, + {file = "ruamel.yaml.clib-0.2.0-cp37-cp37m-win_amd64.whl", hash = "sha256:b1b7fcee6aedcdc7e62c3a73f238b3d080c7ba6650cd808bce8d7761ec484070"}, + {file = "ruamel.yaml.clib-0.2.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:be018933c2f4ee7de55e7bd7d0d801b3dfb09d21dad0cce8a97995fd3e44be30"}, + {file = "ruamel.yaml.clib-0.2.0.tar.gz", hash = "sha256:b66832ea8077d9b3f6e311c4a53d06273db5dc2db6e8a908550f3c14d67e718c"}, ] six = [ {file = "six-1.14.0-py2.py3-none-any.whl", hash = "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"}, @@ -1116,6 +1153,10 @@ toml = [ {file = "toml-0.10.0-py2.py3-none-any.whl", hash = "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"}, {file = "toml-0.10.0.tar.gz", hash = "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c"}, ] +tomlkit = [ + {file = "tomlkit-0.5.11-py2.py3-none-any.whl", hash = "sha256:4e1bd6c9197d984528f9ff0cc9db667c317d8881288db50db20eeeb0f6b0380b"}, + {file = "tomlkit-0.5.11.tar.gz", hash = "sha256:f044eda25647882e5ef22b43a1688fb6ab12af2fc50e8456cdfc751c873101cf"}, +] tornado = [ {file = "tornado-6.0.4-cp35-cp35m-win32.whl", hash = "sha256:5217e601700f24e966ddab689f90b7ea4bd91ff3357c3600fa1045e26d68e55d"}, {file = "tornado-6.0.4-cp35-cp35m-win_amd64.whl", hash = "sha256:c98232a3ac391f5faea6821b53db8db461157baa788f5d6222a193e9456e1740"}, @@ -1166,10 +1207,6 @@ wcwidth = [ wrapt = [ {file = "wrapt-1.11.2.tar.gz", hash = "sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1"}, ] -yorm = [ - {file = "YORM-1.6.2-py3-none-any.whl", hash = "sha256:5bfd925b377690f943ee3523454254a4f875ce33e43b935113f6d1628921e0fb"}, - {file = "YORM-1.6.2.tar.gz", hash = "sha256:e64b3debe9e923784c25237c552545d0bb8ff419cc895188b12401f61cb7b741"}, -] zipp = [ {file = "zipp-3.1.0-py3-none-any.whl", hash = "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b"}, {file = "zipp-3.1.0.tar.gz", hash = "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"}, diff --git a/pyproject.toml b/pyproject.toml index 858932d2..bbb59f19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "1.8b1" +version = "2.0a4" description = "A language-agnostic dependency manager using Git." license = "MIT" @@ -30,7 +30,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Software Development", @@ -41,9 +40,9 @@ classifiers = [ [tool.poetry.dependencies] -python = "^3.6" +python = "^3.7" -YORM = "^1.3" +datafiles = ">=0.7" minilog = "^1.5" [tool.poetry.dev-dependencies] diff --git a/tests/conftest.py b/tests/conftest.py index c0be2394..0fe7393e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,11 +2,11 @@ # pylint: disable=unused-import -import yorm +import datafiles from gitman.tests.conftest import pytest_configure def pytest_runtest_setup(item): # pylint: disable=unused-argument """Ensure files are created for integration tests.""" - yorm.settings.fake = False + datafiles.settings.HOOKS_ENABLED = True diff --git a/tests/test_api.py b/tests/test_api.py index 4f1793fe..2b8794f7 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -51,6 +51,10 @@ link: scripts: - +sources_locked: +- +groups: +- """.lstrip() @@ -66,7 +70,8 @@ def config(): os.system("touch .git") config = Config(root=TMP) - config.__mapper__.text = CONFIG + config.datafile.text = CONFIG + config.datafile.load() log.debug("File listing: %s", os.listdir(TMP)) @@ -81,7 +86,7 @@ def it_creates_a_new_config_file(tmpdir): expect(gitman.init()) == True - expect(Config().__mapper__.text) == strip( + expect(Config().datafile.text) == strip( """ location: gitman_sources sources: @@ -104,14 +109,15 @@ def it_creates_a_new_config_file(tmpdir): link: scripts: - - groups: [] + groups: + - """ ) def it_does_not_modify_existing_config_file(config): expect(gitman.init()) == False - expect(config.__mapper__.text) == CONFIG + expect(config.datafile.text) == CONFIG def describe_install(): @@ -125,10 +131,10 @@ def it_creates_missing_directories(config): def it_should_not_modify_config(config): expect(gitman.install('gitman_1', depth=1)) == True - expect(config.__mapper__.text) == CONFIG + expect(config.datafile.text) == CONFIG def it_merges_sources(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -156,13 +162,14 @@ def it_merges_sources(config): - """ ) + config.datafile.load() expect(gitman.install(depth=1)) == True expect(len(os.listdir(config.location))) == 3 def it_can_handle_missing_locked_sources(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -182,6 +189,7 @@ def it_can_handle_missing_locked_sources(config): - """ ) + config.datafile.load() expect(gitman.install('gitman_1', depth=1)) == True @@ -201,7 +209,7 @@ def it_detects_invalid_repositories(config): def describe_links(): @pytest.fixture def config_with_link(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -213,6 +221,7 @@ def config_with_link(config): - """ ) + config.datafile.load() return config @@ -235,7 +244,7 @@ def it_overwrites_files_with_force(config_with_link): def describe_scripts(): @pytest.fixture def config_with_scripts(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -248,6 +257,7 @@ def config_with_scripts(config): - make foobar """ ) + config.datafile.load() return config @@ -261,7 +271,7 @@ def script_failures_can_be_ignored(config_with_scripts): def describe_sparse_paths(): @pytest.fixture def config_with_scripts(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -276,6 +286,7 @@ def config_with_scripts(config): - """ ) + config.datafile.load() return config @@ -300,7 +311,7 @@ def it_deletes_dependencies_when_they_exist(config): expect(os.path.exists(config.location)) == False - def it_should_not_fail_when_no_dependnecies_exist(config): + def it_should_not_fail_when_no_dependencies_exist(config): expect(os.path.isdir(config.location)) == False expect(gitman.uninstall()) == True @@ -350,10 +361,10 @@ def describe_update(): def it_should_not_modify_config(config): gitman.update('gitman_1', depth=1) - expect(config.__mapper__.text) == CONFIG + expect(config.datafile.text) == CONFIG - def it_locks_previously_locked_dependnecies(config): - config.__mapper__.text = strip( + def it_locks_previously_unlocked_dependencies(config): + config.datafile.text = strip( """ location: deps sources: @@ -385,13 +396,16 @@ def it_locks_previously_locked_dependnecies(config): link: scripts: - - groups: [] + groups: + - """ ) + config.datafile.load() gitman.update(depth=1) - expect(config.__mapper__.text) == strip( + config.datafile.load() + expect(config.datafile.text) == strip( """ location: deps sources: @@ -423,12 +437,13 @@ def it_locks_previously_locked_dependnecies(config): link: scripts: - - groups: [] + groups: + - """ ) - def it_should_not_lock_dependnecies_when_disabled(config): - config.__mapper__.text = strip( + def it_should_not_lock_dependencies_when_disabled(config): + config.datafile.text = strip( """ location: deps sources: @@ -460,13 +475,15 @@ def it_should_not_lock_dependnecies_when_disabled(config): link: scripts: - - groups: [] + groups: + - """ ) + config.datafile.load() gitman.update(depth=1, lock=False) - expect(config.__mapper__.text) == strip( + expect(config.datafile.text) == strip( """ location: deps sources: @@ -498,12 +515,13 @@ def it_should_not_lock_dependnecies_when_disabled(config): link: scripts: - - groups: [] + groups: + - """ ) def it_should_not_allow_source_and_group_name_conflicts(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -522,12 +540,13 @@ def it_should_not_allow_source_and_group_name_conflicts(config): - gitman_2 """ ) + config.datafile.load() with pytest.raises(InvalidConfig): gitman.update(depth=1, lock=True) - def it_locks_previously_locked_dependnecies_by_group_name(config): - config.__mapper__.text = strip( + def it_locks_previously_locked_dependencies_by_group_name(config): + config.datafile.text = strip( """ location: deps sources: @@ -584,10 +603,12 @@ def it_locks_previously_locked_dependnecies_by_group_name(config): - gitman_2 """ ) + config.datafile.load() gitman.update('group_a', depth=1) - expect(config.__mapper__.text) == strip( + config.datafile.load() + expect(config.datafile.text) == strip( """ location: deps sources: @@ -662,7 +683,7 @@ def git_changes( # with no to skip the force process monkeypatch.setattr('builtins.input', lambda x: "n") - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -685,13 +706,15 @@ def git_changes( link: scripts: - - groups: [] + groups: + - """ ) + config.datafile.load() gitman.update(depth=1, force_interactive=True) - expect(config.__mapper__.text) == strip( + expect(config.datafile.text) == strip( """ location: deps sources: @@ -714,7 +737,8 @@ def git_changes( link: scripts: - - groups: [] + groups: + - """ ) @@ -742,7 +766,7 @@ def git_changes( # with yes todo the force process monkeypatch.setattr('builtins.input', lambda x: "y") - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -765,13 +789,16 @@ def git_changes( link: scripts: - - groups: [] + groups: + - """ ) + config.datafile.load() gitman.update(depth=1, force_interactive=True) - expect(config.__mapper__.text) == strip( + config.datafile.load() + expect(config.datafile.text) == strip( """ location: deps sources: @@ -794,12 +821,13 @@ def git_changes( link: scripts: - - groups: [] + groups: + - """ ) def it_merges_sources(config): - config.__mapper__.text = strip( + config.datafile.text = strip( """ location: deps sources: @@ -827,6 +855,7 @@ def it_merges_sources(config): - """ ) + config.datafile.load() expect(gitman.install(depth=1)) == True @@ -861,8 +890,10 @@ def it_records_all_versions_when_no_arguments(config): expect(gitman.update(depth=1, lock=False)) == True expect(gitman.lock()) == True - expect(config.__mapper__.text) == CONFIG + strip( - """ + config.datafile.load() + expect(config.datafile.text).contains( + strip( + """ sources_locked: - name: gitman_1 type: git @@ -891,16 +922,18 @@ def it_records_all_versions_when_no_arguments(config): link: scripts: - - groups: [] """ - ) == config.__mapper__.text + ) + ) def it_records_specified_dependencies(config): expect(gitman.update(depth=1, lock=False)) == True expect(gitman.lock('gitman_1', 'gitman_3')) == True - expect(config.__mapper__.text) == CONFIG + strip( - """ + config.datafile.load() + expect(config.datafile.text).contains( + strip( + """ sources_locked: - name: gitman_1 type: git @@ -920,9 +953,9 @@ def it_records_specified_dependencies(config): link: scripts: - - groups: [] """ - ) == config.__mapper__.text + ) + ) def it_should_fail_on_dirty_repositories(config): expect(gitman.update(depth=1, lock=False)) == True @@ -932,7 +965,7 @@ def it_should_fail_on_dirty_repositories(config): with pytest.raises(UncommittedChanges): gitman.lock() - expect(config.__mapper__.text).does_not_contain("") + expect(config.datafile.text).does_not_contain("") finally: shell.rm(os.path.join("deps", "gitman_1")) @@ -944,7 +977,7 @@ def it_should_fail_on_missing_repositories(config): with pytest.raises(InvalidRepository): gitman.lock() - expect(config.__mapper__.text).does_not_contain("") + expect(config.datafile.text).does_not_contain("") def it_should_fail_on_invalid_repositories(config): shell.mkdir("deps") @@ -955,7 +988,7 @@ def it_should_fail_on_invalid_repositories(config): with pytest.raises(InvalidRepository): gitman.lock() - expect(config.__mapper__.text).does_not_contain("") + expect(config.datafile.text).does_not_contain("") finally: shell.rm(os.path.join("deps", "gitman_1")) From f4e15232ac492fc5a92bd29106a4874d90c28af5 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sat, 4 Apr 2020 20:41:57 -0400 Subject: [PATCH 2/8] Remove unused post-init --- gitman/models/group.py | 9 --------- gitman/models/source.py | 6 ------ gitman/tests/test_models_source.py | 9 --------- tests/test_api.py | 2 +- 4 files changed, 1 insertion(+), 25 deletions(-) diff --git a/gitman/models/group.py b/gitman/models/group.py index 2e133902..79bdb5d6 100644 --- a/gitman/models/group.py +++ b/gitman/models/group.py @@ -1,8 +1,6 @@ from dataclasses import dataclass from typing import List -from .. import exceptions - @dataclass class Group: @@ -11,13 +9,6 @@ class Group: name: str members: List[str] - def __post_init__(self): - # TODO: Remove this? - for name in ['name', 'members']: - if not getattr(self, name): - msg = "'{}' required for {}".format(name, repr(self)) - raise exceptions.InvalidConfig(msg) - def __repr__(self): return "".format(self) diff --git a/gitman/models/source.py b/gitman/models/source.py index 8e9c7de2..a5088db0 100644 --- a/gitman/models/source.py +++ b/gitman/models/source.py @@ -26,12 +26,6 @@ def __post_init__(self): if self.name is None: self.name = self._infer_name(self.repo) - # TODO: Remove this? - for name in ['name', 'repo', 'rev']: - if not getattr(self, name): - msg = "'{}' required for {}".format(name, repr(self)) - raise exceptions.InvalidConfig(msg) - def _on_post_load(self): # TODO: Remove this? self.type = self.type or 'git' diff --git a/gitman/tests/test_models_source.py b/gitman/tests/test_models_source.py index 80de908a..230e9d96 100644 --- a/gitman/tests/test_models_source.py +++ b/gitman/tests/test_models_source.py @@ -39,15 +39,6 @@ def test_init_link(self): assert 'mock/link' == source.link - def test_init_error(self): - """Verify the repository, name, and rev are required.""" - with pytest.raises(ValueError): - Source(type='git', repo='', name='mock_name', rev='master') - with pytest.raises(ValueError): - Source(type='git', repo='http://mock.git', name='', rev='master') - with pytest.raises(ValueError): - Source(type='git', repo='http://mock.git', name='mock_name', rev='') - def test_repr(self, source): """Verify sources can be represented.""" assert "" == repr(source) diff --git a/tests/test_api.py b/tests/test_api.py index 2b8794f7..ed5c0b7a 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -763,7 +763,7 @@ def git_changes( monkeypatch.setattr('gitman.git.changes', git_changes) # patch standard input function to return "y" for each call # this is necessary to answer the force-interactive question - # with yes todo the force process + # with yes to invoke the force process monkeypatch.setattr('builtins.input', lambda x: "y") config.datafile.text = strip( From 335076e38091dd53c960b7966ecd4afb3758a9e0 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sat, 4 Apr 2020 21:08:18 -0400 Subject: [PATCH 3/8] Refactor post-load methods --- gitman/models/config.py | 30 ++++++++++++------------------ gitman/models/source.py | 3 --- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/gitman/models/config.py b/gitman/models/config.py index 164df90b..71448fce 100644 --- a/gitman/models/config.py +++ b/gitman/models/config.py @@ -25,23 +25,6 @@ def __post_init__(self): if self.root is None: self.root = os.getcwd() - def _on_post_load(self): - for source in self.sources: - source._on_post_load() # pylint: disable=protected-access - - for source in self.sources_locked: - source._on_post_load() # pylint: disable=protected-access - - # check for conflicts between source names and group names - for source in self.sources: - for group in self.groups: - if source.name == group.name: - msg = ( - "Name conflict detected between source name and " - "group name \"{}\"" - ).format(source.name) - raise exceptions.InvalidConfig(msg) - @property def config_path(self): """Get the full path to the config file.""" @@ -61,6 +44,17 @@ def location_path(self): assert self.root return os.path.normpath(os.path.join(self.root, self.location)) + def validate(self): + """Check for conflicts between source names and group names.""" + for source in self.sources: + for group in self.groups: + if source.name == group.name: + msg = ( + "Name conflict detected between source name and " + "group name \"{}\"" + ).format(source.name) + raise exceptions.InvalidConfig(msg) + def get_path(self, name=None): """Get the full path to a dependency or internal file.""" base = self.location_path @@ -340,7 +334,7 @@ def load_config(start=None, *, search=True): for filename in os.listdir(path): if _valid_filename(filename): config = Config(path, filename) - config._on_post_load() # pylint: disable=protected-access + config.validate() log.debug("Found config: %s", config.path) return config diff --git a/gitman/models/source.py b/gitman/models/source.py index a5088db0..5221ba50 100644 --- a/gitman/models/source.py +++ b/gitman/models/source.py @@ -25,9 +25,6 @@ class Source: def __post_init__(self): if self.name is None: self.name = self._infer_name(self.repo) - - def _on_post_load(self): - # TODO: Remove this? self.type = self.type or 'git' def __repr__(self): From cce1b7a23c7b7d5eebda4e2c069b385b1db2ff3b Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sun, 5 Apr 2020 21:04:31 -0400 Subject: [PATCH 4/8] Bump version to 2.0b1 --- CHANGELOG.md | 2 +- gitman/cli.py | 1 - gitman/common.py | 2 +- gitman/git.py | 2 +- poetry.lock | 12 ++++++------ pyproject.toml | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f925b3b6..793b596a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 2.0 (alpha) +# 2.0 (beta) - **BREAKING**: Dropped support for Python 3.6. - Switched to `datafiles` for YAML serialization. diff --git a/gitman/cli.py b/gitman/cli.py index 75fd4a6e..4f8cdcc7 100644 --- a/gitman/cli.py +++ b/gitman/cli.py @@ -322,7 +322,6 @@ def _run_command(function, args, kwargs): def _show_error(exception): - # TODO: require level=, evaluate all calls to dedent() common.dedent(0) common.newline() common.show(str(exception), color='error') diff --git a/gitman/common.py b/gitman/common.py index 91318066..32331543 100644 --- a/gitman/common.py +++ b/gitman/common.py @@ -79,7 +79,7 @@ def configure_logging(count=0): verbose_format = settings.VERBOSE2_LOGGING_FORMAT # Set a custom formatter - log.reset() # TODO: this shouldn't be necessary + log.reset() log.init(level=level) log.silence('datafiles', allow_warning=True) logging.captureWarnings(True) diff --git a/gitman/git.py b/gitman/git.py index 491d1ba7..5c8625d4 100644 --- a/gitman/git.py +++ b/gitman/git.py @@ -256,7 +256,7 @@ def get_branch(): def _get_sha_from_rev(rev): """Get a rev-parse string's hash.""" - if '@{' in rev: # TODO: use regex for this + if '@{' in rev: parts = rev.split('@') branch = parts[0] date = parts[1].strip("{}") diff --git a/poetry.lock b/poetry.lock index 6ac41ebf..016812cf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -88,7 +88,7 @@ description = "Python package for providing Mozilla's CA Bundle." name = "certifi" optional = false python-versions = "*" -version = "2019.11.28" +version = "2020.4.5.1" [[package]] category = "dev" @@ -489,7 +489,7 @@ description = "Python parsing module" name = "pyparsing" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "2.4.6" +version = "2.4.7" [[package]] category = "dev" @@ -807,8 +807,8 @@ cached-property = [ {file = "cached_property-1.5.1-py2.py3-none-any.whl", hash = "sha256:3a026f1a54135677e7da5ce819b0c690f156f37976f3e30c5430740725203d7f"}, ] certifi = [ - {file = "certifi-2019.11.28-py2.py3-none-any.whl", hash = "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3"}, - {file = "certifi-2019.11.28.tar.gz", hash = "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"}, + {file = "certifi-2020.4.5.1-py2.py3-none-any.whl", hash = "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304"}, + {file = "certifi-2020.4.5.1.tar.gz", hash = "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519"}, ] chardet = [ {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, @@ -1039,8 +1039,8 @@ pync = [ {file = "pync-2.0.3.tar.gz", hash = "sha256:38b9e61735a3161f9211a5773c5f5ea698f36af4ff7f77fa03e8d1ff0caa117f"}, ] pyparsing = [ - {file = "pyparsing-2.4.6-py2.py3-none-any.whl", hash = "sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec"}, - {file = "pyparsing-2.4.6.tar.gz", hash = "sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f"}, + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ {file = "pytest-5.4.1-py3-none-any.whl", hash = "sha256:0e5b30f5cb04e887b91b1ee519fa3d89049595f428c1db76e73bd7f17b09b172"}, diff --git a/pyproject.toml b/pyproject.toml index bbb59f19..815ec852 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "2.0a4" +version = "2.0b1" description = "A language-agnostic dependency manager using Git." license = "MIT" From 1a41572ef6557dc4cf7241a5b8d7553ff6f94c5e Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sun, 5 Apr 2020 21:32:49 -0400 Subject: [PATCH 5/8] Refactor tests --- tests/test_api.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index ed5c0b7a..2452a215 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -324,37 +324,36 @@ def it_deletes_the_log_file(config): gitman.uninstall() expect(os.path.exists(config.log_path)) == False + def describe_keep_location(): + def it_deletes_dependencies_when_they_exist(config): + gitman.install('gitman_1', depth=1) + expect(os.path.isdir(config.location)) == True -def describe_keep_location(): - def it_deletes_dependencies_when_they_exist(config): - gitman.install('gitman_1', depth=1) - expect(os.path.isdir(config.location)) == True + expect(gitman.uninstall(keep_location=True)) == True - expect(gitman.uninstall(keep_location=True)) == True + path = os.path.join(config.location, 'gitman_1') + expect(os.path.exists(path)) == False - path = os.path.join(config.location, 'gitman_1') - expect(os.path.exists(path)) == False + expect(os.path.exists(config.location)) == True - expect(os.path.exists(config.location)) == True + gitman.uninstall() - gitman.uninstall() - - def it_should_not_fail_when_no_dependencies_exist(config): - expect(os.path.isdir(config.location)) == False + def it_should_not_fail_when_no_dependencies_exist(config): + expect(os.path.isdir(config.location)) == False - expect(gitman.uninstall(keep_location=True)) == True + expect(gitman.uninstall(keep_location=True)) == True - gitman.uninstall() + gitman.uninstall() - def it_deletes_the_log_file(config): - gitman.install('gitman_1', depth=1) - gitman.list() - expect(os.path.exists(config.log_path)) == True + def it_deletes_the_log_file(config): + gitman.install('gitman_1', depth=1) + gitman.list() + expect(os.path.exists(config.log_path)) == True - gitman.uninstall(keep_location=True) - expect(os.path.exists(config.log_path)) == False + gitman.uninstall(keep_location=True) + expect(os.path.exists(config.log_path)) == False - gitman.uninstall() + gitman.uninstall() def describe_update(): From 79fe0098340deaa2ada4a3e3f59d3e23f3ea633c Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sun, 12 Apr 2020 14:19:28 -0400 Subject: [PATCH 6/8] Remove legacy CLI entry point --- CHANGELOG.md | 1 + gitman/models/config.py | 2 +- poetry.lock | 28 ++++++++++++++++++++-------- pyproject.toml | 6 ++---- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 793b596a..13b713db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 2.0 (beta) +- **BREAKING**: Removed legacy `gdm` CLI entry point. - **BREAKING**: Dropped support for Python 3.6. - Switched to `datafiles` for YAML serialization. diff --git a/gitman/models/config.py b/gitman/models/config.py index 71448fce..90efb467 100644 --- a/gitman/models/config.py +++ b/gitman/models/config.py @@ -355,4 +355,4 @@ def _valid_filename(filename): name, ext = os.path.splitext(filename.lower()) if name.startswith('.'): name = name[1:] - return name in ['gitman', 'gdm'] and ext in ['.yml', '.yaml'] + return name in {'gitman', 'gdm'} and ext in {'.yml', '.yaml'} diff --git a/poetry.lock b/poetry.lock index 016812cf..2f9ae3fd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -154,7 +154,7 @@ description = "File-based ORM for dataclasses." name = "datafiles" optional = false python-versions = ">=3.7,<4.0" -version = "0.8.1" +version = "0.9b4" [package.dependencies] PyYAML = ">=5.2,<6.0" @@ -162,7 +162,7 @@ cached_property = ">=1.5,<2.0" classproperties = ">=0.1.3,<0.2.0" minilog = ">=1.4.1,<2.0.0" parse = ">=1.12,<2.0" -"ruamel.yaml" = ">=0.16.7,<0.17.0" +"ruamel.yaml" = ">=0.16.10,<0.17.0" tomlkit = ">=0.5.3,<0.6.0" typing-extensions = ">=3.7,<4.0" @@ -395,7 +395,7 @@ description = "Utility library for gitignore style pattern matching of file path name = "pathspec" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.7.0" +version = "0.8.0" [[package]] category = "dev" @@ -774,7 +774,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "ab7751bbd889c75a72bee782fc9e7deddc30cf82de28121c550e6a5ae5c12b49" +content-hash = "04f8ec219dc14ddc092444d5b4d33cbe6da6ec7b17d81e2ed877578d90c5c92a" python-versions = "^3.7" [metadata.files] @@ -863,8 +863,8 @@ coveragespace = [ {file = "coveragespace-3.1.1.tar.gz", hash = "sha256:c5862d04a91bec32fc7dd8487006922e144280dc05e75b26c38f4ffe4e760fb0"}, ] datafiles = [ - {file = "datafiles-0.8.1-py3-none-any.whl", hash = "sha256:6acd8c57f3b03adc500712fe81002169138d5be4d0af8d8007aeed4c4312a6c4"}, - {file = "datafiles-0.8.1.tar.gz", hash = "sha256:b1cac290dc4556d61e6358f8ff15634d21287a3e9436ce6dce7a6b38003e7521"}, + {file = "datafiles-0.9b4-py3-none-any.whl", hash = "sha256:ffe87fb360221c8b6c2661df35cc43ccf0314e9a81fc4c15b5410225dabab620"}, + {file = "datafiles-0.9b4.tar.gz", hash = "sha256:27e7bad1c4cc1db60d759942ead8dce7c84be9d264734e4810ec23b1ef67cce9"}, ] dis3 = [ {file = "dis3-0.1.3-py2-none-any.whl", hash = "sha256:61f7720dd0d8749d23fda3d7227ce74d73da11c2fade993a67ab2f9852451b14"}, @@ -1012,8 +1012,8 @@ parse = [ {file = "parse-1.15.0.tar.gz", hash = "sha256:a6d4e2c2f1fbde6717d28084a191a052950f758c0cbd83805357e6575c2b95c0"}, ] pathspec = [ - {file = "pathspec-0.7.0-py2.py3-none-any.whl", hash = "sha256:163b0632d4e31cef212976cf57b43d9fd6b0bac6e67c26015d611a647d5e7424"}, - {file = "pathspec-0.7.0.tar.gz", hash = "sha256:562aa70af2e0d434367d9790ad37aed893de47f1693e4201fd1d3dca15d19b96"}, + {file = "pathspec-0.8.0-py2.py3-none-any.whl", hash = "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0"}, + {file = "pathspec-0.8.0.tar.gz", hash = "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061"}, ] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, @@ -1082,10 +1082,22 @@ pyyaml = [ regex = [ {file = "regex-2020.4.4-cp27-cp27m-win32.whl", hash = "sha256:90742c6ff121a9c5b261b9b215cb476eea97df98ea82037ec8ac95d1be7a034f"}, {file = "regex-2020.4.4-cp27-cp27m-win_amd64.whl", hash = "sha256:24f4f4062eb16c5bbfff6a22312e8eab92c2c99c51a02e39b4eae54ce8255cd1"}, + {file = "regex-2020.4.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:08119f707f0ebf2da60d2f24c2f39ca616277bb67ef6c92b72cbf90cbe3a556b"}, + {file = "regex-2020.4.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:c9423a150d3a4fc0f3f2aae897a59919acd293f4cb397429b120a5fcd96ea3db"}, + {file = "regex-2020.4.4-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:c087bff162158536387c53647411db09b6ee3f9603c334c90943e97b1052a156"}, + {file = "regex-2020.4.4-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:1cbe0fa0b7f673400eb29e9ef41d4f53638f65f9a2143854de6b1ce2899185c3"}, {file = "regex-2020.4.4-cp36-cp36m-win32.whl", hash = "sha256:0ce9537396d8f556bcfc317c65b6a0705320701e5ce511f05fc04421ba05b8a8"}, {file = "regex-2020.4.4-cp36-cp36m-win_amd64.whl", hash = "sha256:7e1037073b1b7053ee74c3c6c0ada80f3501ec29d5f46e42669378eae6d4405a"}, + {file = "regex-2020.4.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:4385f12aa289d79419fede43f979e372f527892ac44a541b5446617e4406c468"}, + {file = "regex-2020.4.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:a58dd45cb865be0ce1d5ecc4cfc85cd8c6867bea66733623e54bd95131f473b6"}, + {file = "regex-2020.4.4-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:ccccdd84912875e34c5ad2d06e1989d890d43af6c2242c6fcfa51556997af6cd"}, + {file = "regex-2020.4.4-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:ea4adf02d23b437684cd388d557bf76e3afa72f7fed5bbc013482cc00c816948"}, {file = "regex-2020.4.4-cp37-cp37m-win32.whl", hash = "sha256:2294f8b70e058a2553cd009df003a20802ef75b3c629506be20687df0908177e"}, {file = "regex-2020.4.4-cp37-cp37m-win_amd64.whl", hash = "sha256:e91ba11da11cf770f389e47c3f5c30473e6d85e06d7fd9dcba0017d2867aab4a"}, + {file = "regex-2020.4.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:5635cd1ed0a12b4c42cce18a8d2fb53ff13ff537f09de5fd791e97de27b6400e"}, + {file = "regex-2020.4.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:23069d9c07e115537f37270d1d5faea3e0bdded8279081c4d4d607a2ad393683"}, + {file = "regex-2020.4.4-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:c162a21e0da33eb3d31a3ac17a51db5e634fc347f650d271f0305d96601dc15b"}, + {file = "regex-2020.4.4-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:fb95debbd1a824b2c4376932f2216cc186912e389bdb0e27147778cf6acb3f89"}, {file = "regex-2020.4.4-cp38-cp38-win32.whl", hash = "sha256:2a3bf8b48f8e37c3a40bb3f854bf0121c194e69a650b209628d951190b862de3"}, {file = "regex-2020.4.4-cp38-cp38-win_amd64.whl", hash = "sha256:5bfed051dbff32fd8945eccca70f5e22b55e4148d2a8a45141a3b053d6455ae3"}, {file = "regex-2020.4.4.tar.gz", hash = "sha256:295badf61a51add2d428a46b8580309c520d8b26e769868b922750cf3ce67142"}, diff --git a/pyproject.toml b/pyproject.toml index 815ec852..241bfa62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "2.0b1" +version = "2.0b2" description = "A language-agnostic dependency manager using Git." license = "MIT" @@ -42,7 +42,7 @@ classifiers = [ python = "^3.7" -datafiles = ">=0.7" +datafiles = ">=0.9b4" minilog = "^1.5" [tool.poetry.dev-dependencies] @@ -83,8 +83,6 @@ rope = "^0.14.0" gitman = "gitman.cli:main" git-deps = "gitman.plugin:main" -gdm = "gitman.cli:main" # legacy entry point - [tool.black] target-version = ["py36"] From df5229698a2d18486adfd16f71c53794321de37f Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sun, 12 Apr 2020 14:54:29 -0400 Subject: [PATCH 7/8] Switch to indented YAML in configuration files --- .isort.cfg | 2 +- gitman.yml | 168 ++++---- gitman/settings.py | 15 +- poetry.lock | 8 +- pyproject.toml | 4 +- tests/test_api.py | 936 ++++++++++++++++++++++----------------------- 6 files changed, 564 insertions(+), 569 deletions(-) diff --git a/.isort.cfg b/.isort.cfg index 55a392b7..196d9245 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -5,7 +5,7 @@ not_skip = __init__.py multi_line_output = 3 known_standard_library = dataclasses,typing_extensions -known_third_party = click,log +known_third_party = click,log,datafiles known_first_party = gitman combine_as_imports = true diff --git a/gitman.yml b/gitman.yml index 0e98cbc7..eb2fa2e7 100644 --- a/gitman.yml +++ b/gitman.yml @@ -1,88 +1,88 @@ location: demo sources: -- name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - cat .noserc - - make foobar -- name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - -- name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: master@{2015-06-18 11:11:11} - link: - scripts: - - echo "Hello, World!" - - pwd -- name: gitman_4 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch-2 - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - cat .noserc + - make foobar + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: master@{2015-06-18 11:11:11} + link: + scripts: + - echo "Hello, World!" + - pwd + - name: gitman_4 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch-2 + link: + scripts: + - sources_locked: -- name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd - link: - scripts: - - cat .noserc - - make foobar -- name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - -- name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 2da24fca34af3748e3cab61db81a2ae8b35aec94 - link: - scripts: - - echo "Hello, World!" - - pwd -- name: gitman_4 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: f50c1ac8bf27377625b0cc93ea27f8069c7b513a - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd + link: + scripts: + - cat .noserc + - make foobar + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 2da24fca34af3748e3cab61db81a2ae8b35aec94 + link: + scripts: + - echo "Hello, World!" + - pwd + - name: gitman_4 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: f50c1ac8bf27377625b0cc93ea27f8069c7b513a + link: + scripts: + - groups: -- name: group_a - members: - - gitman_1 - - gitman_4 -- name: group_b - members: - - gitman 2 - - gitman_3 + - name: group_a + members: + - gitman_1 + - gitman_4 + - name: group_b + members: + - gitman 2 + - gitman_3 diff --git a/gitman/settings.py b/gitman/settings.py index 58426f85..52f2d807 100644 --- a/gitman/settings.py +++ b/gitman/settings.py @@ -1,13 +1,8 @@ """Program defaults.""" +import logging import os -import datafiles -import log - - -# Serialization settings -datafiles.settings.INDENT_YAML_BLOCKS = False # Cache settings CACHE = os.path.expanduser(os.getenv('GITMAN_CACHE', "~/.gitcache")) @@ -18,8 +13,8 @@ LEVELED_LOGGING_FORMAT = "%(levelname)s: %(message)s" VERBOSE_LOGGING_FORMAT = "[%(levelname)-8s] %(message)s" VERBOSE2_LOGGING_FORMAT = "[%(levelname)-8s] (%(name)s @%(lineno)4d) %(message)s" -QUIET_LOGGING_LEVEL = log.ERROR -DEFAULT_LOGGING_LEVEL = log.WARNING -VERBOSE_LOGGING_LEVEL = log.INFO -VERBOSE2_LOGGING_LEVEL = log.DEBUG +QUIET_LOGGING_LEVEL = logging.ERROR +DEFAULT_LOGGING_LEVEL = logging.WARNING +VERBOSE_LOGGING_LEVEL = logging.INFO +VERBOSE2_LOGGING_LEVEL = logging.DEBUG LOGGING_DATEFMT = "%Y-%m-%d %H:%M" diff --git a/poetry.lock b/poetry.lock index 2f9ae3fd..eba2e1d9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -154,7 +154,7 @@ description = "File-based ORM for dataclasses." name = "datafiles" optional = false python-versions = ">=3.7,<4.0" -version = "0.9b4" +version = "0.9b5" [package.dependencies] PyYAML = ">=5.2,<6.0" @@ -774,7 +774,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "04f8ec219dc14ddc092444d5b4d33cbe6da6ec7b17d81e2ed877578d90c5c92a" +content-hash = "91eb561c8ec489ce34bf120d5bbda531e80655804ec645a8a53f1962716ad037" python-versions = "^3.7" [metadata.files] @@ -863,8 +863,8 @@ coveragespace = [ {file = "coveragespace-3.1.1.tar.gz", hash = "sha256:c5862d04a91bec32fc7dd8487006922e144280dc05e75b26c38f4ffe4e760fb0"}, ] datafiles = [ - {file = "datafiles-0.9b4-py3-none-any.whl", hash = "sha256:ffe87fb360221c8b6c2661df35cc43ccf0314e9a81fc4c15b5410225dabab620"}, - {file = "datafiles-0.9b4.tar.gz", hash = "sha256:27e7bad1c4cc1db60d759942ead8dce7c84be9d264734e4810ec23b1ef67cce9"}, + {file = "datafiles-0.9b5-py3-none-any.whl", hash = "sha256:2a6be82fa6de6fb31477108d3a8aa9862168de2a1369dba09a4ecbdf1621936d"}, + {file = "datafiles-0.9b5.tar.gz", hash = "sha256:9d455c9fbb6785161a85dc18a989cacff6c5ecb6a46452d763d7dc36da4bb3bd"}, ] dis3 = [ {file = "dis3-0.1.3-py2-none-any.whl", hash = "sha256:61f7720dd0d8749d23fda3d7227ce74d73da11c2fade993a67ab2f9852451b14"}, diff --git a/pyproject.toml b/pyproject.toml index 241bfa62..f9af0fb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "2.0b2" +version = "2.0b3" description = "A language-agnostic dependency manager using Git." license = "MIT" @@ -42,7 +42,7 @@ classifiers = [ python = "^3.7" -datafiles = ">=0.9b4" +datafiles = ">=0.9b5" minilog = "^1.5" [tool.poetry.dev-dependencies] diff --git a/tests/test_api.py b/tests/test_api.py index 2452a215..a27c212a 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -24,37 +24,37 @@ CONFIG = """ location: deps sources: -- name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - -- name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - -- name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 9bf18e16b956041f0267c21baad555a23237b52e - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 9bf18e16b956041f0267c21baad555a23237b52e + link: + scripts: + - sources_locked: -- + - groups: -- + - """.lstrip() @@ -90,27 +90,27 @@ def it_creates_a_new_config_file(tmpdir): """ location: gitman_sources sources: - - name: sample_dependency - type: git - repo: https://github.com/githubtraining/hellogitworld - sparse_paths: - - - rev: master - link: - scripts: - - + - name: sample_dependency + type: git + repo: https://github.com/githubtraining/hellogitworld + sparse_paths: + - + rev: master + link: + scripts: + - sources_locked: - - name: sample_dependency - type: git - repo: https://github.com/githubtraining/hellogitworld - sparse_paths: - - - rev: ebbbf773431ba07510251bb03f9525c7bab2b13a - link: - scripts: - - + - name: sample_dependency + type: git + repo: https://github.com/githubtraining/hellogitworld + sparse_paths: + - + rev: ebbbf773431ba07510251bb03f9525c7bab2b13a + link: + scripts: + - groups: - - + - """ ) @@ -138,28 +138,28 @@ def it_merges_sources(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch - link: - scripts: - - - - name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - """ ) config.datafile.load() @@ -173,20 +173,20 @@ def it_can_handle_missing_locked_sources(config): """ location: deps sources: - - name: gitman_1 - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch - link: - scripts: - - + - name: gitman_1 + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - """ ) config.datafile.load() @@ -213,12 +213,12 @@ def config_with_link(config): """ location: deps sources: - - name: gitman_1 - repo: https://github.com/jacebrowning/gitman-demo - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: my_link - scripts: - - + - name: gitman_1 + repo: https://github.com/jacebrowning/gitman-demo + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: my_link + scripts: + - """ ) config.datafile.load() @@ -248,13 +248,13 @@ def config_with_scripts(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - make foobar + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - make foobar """ ) config.datafile.load() @@ -275,15 +275,15 @@ def config_with_scripts(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - src/* - rev: ddbe17ef173538d1fda29bd99a14bab3c5d86e78 - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - src/* + rev: ddbe17ef173538d1fda29bd99a14bab3c5d86e78 + link: + scripts: + - """ ) config.datafile.load() @@ -367,36 +367,36 @@ def it_locks_previously_unlocked_dependencies(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - + - """ ) config.datafile.load() @@ -408,36 +408,36 @@ def it_locks_previously_unlocked_dependencies(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - groups: - - + - """ ) @@ -446,36 +446,36 @@ def it_should_not_lock_dependencies_when_disabled(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - + - """ ) config.datafile.load() @@ -486,36 +486,36 @@ def it_should_not_lock_dependencies_when_disabled(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - + - """ ) @@ -524,19 +524,19 @@ def it_should_not_allow_source_and_group_name_conflicts(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch groups: - - name: gitman_1 - members: - - gitman_1 - - gitman_2 + - name: gitman_1 + members: + - gitman_1 + - gitman_2 """ ) config.datafile.load() @@ -549,57 +549,57 @@ def it_locks_previously_locked_dependencies_by_group_name(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - - - name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - name: group_a - members: - - gitman_1 - - gitman_2 + - name: group_a + members: + - gitman_1 + - gitman_2 """ ) config.datafile.load() @@ -611,57 +611,57 @@ def it_locks_previously_locked_dependencies_by_group_name(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-branch - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - - - name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-branch + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - groups: - - name: group_a - members: - - gitman_1 - - gitman_2 + - name: group_a + members: + - gitman_1 + - gitman_2 """ ) @@ -686,27 +686,27 @@ def git_changes( """ location: deps sources: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - + - """ ) config.datafile.load() @@ -717,27 +717,27 @@ def git_changes( """ location: deps sources: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - + - """ ) @@ -769,27 +769,27 @@ def git_changes( """ location: deps sources: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: (old revision) - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: (old revision) + link: + scripts: + - groups: - - + - """ ) config.datafile.load() @@ -801,27 +801,27 @@ def git_changes( """ location: deps sources: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: example-tag - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: example-tag + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - groups: - - + - """ ) @@ -830,28 +830,28 @@ def it_merges_sources(config): """ location: deps sources: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch + link: + scripts: + - sources_locked: - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: example-branch - link: - scripts: - - - - name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: example-branch + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - """ ) config.datafile.load() @@ -894,33 +894,33 @@ def it_records_all_versions_when_no_arguments(config): strip( """ sources_locked: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd - link: - scripts: - - - - name: gitman_2 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - link: - scripts: - - - - name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 9bf18e16b956041f0267c21baad555a23237b52e - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd + link: + scripts: + - + - name: gitman_2 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 9bf18e16b956041f0267c21baad555a23237b52e + link: + scripts: + - """ ) ) @@ -934,24 +934,24 @@ def it_records_specified_dependencies(config): strip( """ sources_locked: - - name: gitman_1 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd - link: - scripts: - - - - name: gitman_3 - type: git - repo: https://github.com/jacebrowning/gitman-demo - sparse_paths: - - - rev: 9bf18e16b956041f0267c21baad555a23237b52e - link: - scripts: - - + - name: gitman_1 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd + link: + scripts: + - + - name: gitman_3 + type: git + repo: https://github.com/jacebrowning/gitman-demo + sparse_paths: + - + rev: 9bf18e16b956041f0267c21baad555a23237b52e + link: + scripts: + - """ ) ) From 4afe028412628fcd376bee844c449d272cb4415a Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Mon, 13 Apr 2020 09:45:21 -0400 Subject: [PATCH 8/8] Bump version to 2.0 --- CHANGELOG.md | 2 +- poetry.lock | 72 +++++++++++++++++++++++++------------------------- pyproject.toml | 4 +-- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13b713db..532e9e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 2.0 (beta) +# 2.0 (2020-04-13) - **BREAKING**: Removed legacy `gdm` CLI entry point. - **BREAKING**: Dropped support for Python 3.6. diff --git a/poetry.lock b/poetry.lock index eba2e1d9..fd6c24ef 100644 --- a/poetry.lock +++ b/poetry.lock @@ -128,7 +128,7 @@ description = "Code coverage measurement for Python" name = "coverage" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" -version = "5.0.4" +version = "5.1" [package.extras] toml = ["toml"] @@ -154,7 +154,7 @@ description = "File-based ORM for dataclasses." name = "datafiles" optional = false python-versions = ">=3.7,<4.0" -version = "0.9b5" +version = "0.9" [package.dependencies] PyYAML = ">=5.2,<6.0" @@ -774,7 +774,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "91eb561c8ec489ce34bf120d5bbda531e80655804ec645a8a53f1962716ad037" +content-hash = "51a15b0d625db06bd6f1b5cd782fa129185d9d43654a54459a4cabd62f947e20" python-versions = "^3.7" [metadata.files] @@ -826,45 +826,45 @@ colorama = [ {file = "colorama-0.3.9.tar.gz", hash = "sha256:48eb22f4f8461b1df5734a074b57042430fb06e1d61bd1e11b078c0fe6d7a1f1"}, ] coverage = [ - {file = "coverage-5.0.4-cp27-cp27m-macosx_10_12_x86_64.whl", hash = "sha256:8a620767b8209f3446197c0e29ba895d75a1e272a36af0786ec70fe7834e4307"}, - {file = "coverage-5.0.4-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:73aa6e86034dad9f00f4bbf5a666a889d17d79db73bc5af04abd6c20a014d9c8"}, - {file = "coverage-5.0.4-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:408ce64078398b2ee2ec08199ea3fcf382828d2f8a19c5a5ba2946fe5ddc6c31"}, - {file = "coverage-5.0.4-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:cda33311cb9fb9323958a69499a667bd728a39a7aa4718d7622597a44c4f1441"}, - {file = "coverage-5.0.4-cp27-cp27m-win32.whl", hash = "sha256:5f587dfd83cb669933186661a351ad6fc7166273bc3e3a1531ec5c783d997aac"}, - {file = "coverage-5.0.4-cp27-cp27m-win_amd64.whl", hash = "sha256:9fad78c13e71546a76c2f8789623eec8e499f8d2d799f4b4547162ce0a4df435"}, - {file = "coverage-5.0.4-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:2e08c32cbede4a29e2a701822291ae2bc9b5220a971bba9d1e7615312efd3037"}, - {file = "coverage-5.0.4-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:922fb9ef2c67c3ab20e22948dcfd783397e4c043a5c5fa5ff5e9df5529074b0a"}, - {file = "coverage-5.0.4-cp35-cp35m-macosx_10_12_x86_64.whl", hash = "sha256:c3fc325ce4cbf902d05a80daa47b645d07e796a80682c1c5800d6ac5045193e5"}, - {file = "coverage-5.0.4-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:046a1a742e66d065d16fb564a26c2a15867f17695e7f3d358d7b1ad8a61bca30"}, - {file = "coverage-5.0.4-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:6ad6ca45e9e92c05295f638e78cd42bfaaf8ee07878c9ed73e93190b26c125f7"}, - {file = "coverage-5.0.4-cp35-cp35m-win32.whl", hash = "sha256:eda55e6e9ea258f5e4add23bcf33dc53b2c319e70806e180aecbff8d90ea24de"}, - {file = "coverage-5.0.4-cp35-cp35m-win_amd64.whl", hash = "sha256:4a8a259bf990044351baf69d3b23e575699dd60b18460c71e81dc565f5819ac1"}, - {file = "coverage-5.0.4-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:f372cdbb240e09ee855735b9d85e7f50730dcfb6296b74b95a3e5dea0615c4c1"}, - {file = "coverage-5.0.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a37c6233b28e5bc340054cf6170e7090a4e85069513320275a4dc929144dccf0"}, - {file = "coverage-5.0.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:443be7602c790960b9514567917af538cac7807a7c0c0727c4d2bbd4014920fd"}, - {file = "coverage-5.0.4-cp36-cp36m-win32.whl", hash = "sha256:165a48268bfb5a77e2d9dbb80de7ea917332a79c7adb747bd005b3a07ff8caf0"}, - {file = "coverage-5.0.4-cp36-cp36m-win_amd64.whl", hash = "sha256:0a907199566269e1cfa304325cc3b45c72ae341fbb3253ddde19fa820ded7a8b"}, - {file = "coverage-5.0.4-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:513e6526e0082c59a984448f4104c9bf346c2da9961779ede1fc458e8e8a1f78"}, - {file = "coverage-5.0.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:3844c3dab800ca8536f75ae89f3cf566848a3eb2af4d9f7b1103b4f4f7a5dad6"}, - {file = "coverage-5.0.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:641e329e7f2c01531c45c687efcec8aeca2a78a4ff26d49184dce3d53fc35014"}, - {file = "coverage-5.0.4-cp37-cp37m-win32.whl", hash = "sha256:db1d4e38c9b15be1521722e946ee24f6db95b189d1447fa9ff18dd16ba89f732"}, - {file = "coverage-5.0.4-cp37-cp37m-win_amd64.whl", hash = "sha256:62061e87071497951155cbccee487980524d7abea647a1b2a6eb6b9647df9006"}, - {file = "coverage-5.0.4-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:65a7e00c00472cd0f59ae09d2fb8a8aaae7f4a0cf54b2b74f3138d9f9ceb9cb2"}, - {file = "coverage-5.0.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1f66cf263ec77af5b8fe14ef14c5e46e2eb4a795ac495ad7c03adc72ae43fafe"}, - {file = "coverage-5.0.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:85596aa5d9aac1bf39fe39d9fa1051b0f00823982a1de5766e35d495b4a36ca9"}, - {file = "coverage-5.0.4-cp38-cp38-win32.whl", hash = "sha256:86a0ea78fd851b313b2e712266f663e13b6bc78c2fb260b079e8b67d970474b1"}, - {file = "coverage-5.0.4-cp38-cp38-win_amd64.whl", hash = "sha256:03f630aba2b9b0d69871c2e8d23a69b7fe94a1e2f5f10df5049c0df99db639a0"}, - {file = "coverage-5.0.4-cp39-cp39-win32.whl", hash = "sha256:7c9762f80a25d8d0e4ab3cb1af5d9dffbddb3ee5d21c43e3474c84bf5ff941f7"}, - {file = "coverage-5.0.4-cp39-cp39-win_amd64.whl", hash = "sha256:4482f69e0701139d0f2c44f3c395d1d1d37abd81bfafbf9b6efbe2542679d892"}, - {file = "coverage-5.0.4.tar.gz", hash = "sha256:1b60a95fc995649464e0cd48cecc8288bac5f4198f21d04b8229dc4097d76823"}, + {file = "coverage-5.1-cp27-cp27m-macosx_10_12_x86_64.whl", hash = "sha256:0cb4be7e784dcdc050fc58ef05b71aa8e89b7e6636b99967fadbdba694cf2b65"}, + {file = "coverage-5.1-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:c317eaf5ff46a34305b202e73404f55f7389ef834b8dbf4da09b9b9b37f76dd2"}, + {file = "coverage-5.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b83835506dfc185a319031cf853fa4bb1b3974b1f913f5bb1a0f3d98bdcded04"}, + {file = "coverage-5.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5f2294dbf7875b991c381e3d5af2bcc3494d836affa52b809c91697449d0eda6"}, + {file = "coverage-5.1-cp27-cp27m-win32.whl", hash = "sha256:de807ae933cfb7f0c7d9d981a053772452217df2bf38e7e6267c9cbf9545a796"}, + {file = "coverage-5.1-cp27-cp27m-win_amd64.whl", hash = "sha256:bf9cb9a9fd8891e7efd2d44deb24b86d647394b9705b744ff6f8261e6f29a730"}, + {file = "coverage-5.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:acf3763ed01af8410fc36afea23707d4ea58ba7e86a8ee915dfb9ceff9ef69d0"}, + {file = "coverage-5.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:dec5202bfe6f672d4511086e125db035a52b00f1648d6407cc8e526912c0353a"}, + {file = "coverage-5.1-cp35-cp35m-macosx_10_12_x86_64.whl", hash = "sha256:7a5bdad4edec57b5fb8dae7d3ee58622d626fd3a0be0dfceda162a7035885ecf"}, + {file = "coverage-5.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:1601e480b9b99697a570cea7ef749e88123c04b92d84cedaa01e117436b4a0a9"}, + {file = "coverage-5.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:dbe8c6ae7534b5b024296464f387d57c13caa942f6d8e6e0346f27e509f0f768"}, + {file = "coverage-5.1-cp35-cp35m-win32.whl", hash = "sha256:a027ef0492ede1e03a8054e3c37b8def89a1e3c471482e9f046906ba4f2aafd2"}, + {file = "coverage-5.1-cp35-cp35m-win_amd64.whl", hash = "sha256:0e61d9803d5851849c24f78227939c701ced6704f337cad0a91e0972c51c1ee7"}, + {file = "coverage-5.1-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:2d27a3f742c98e5c6b461ee6ef7287400a1956c11421eb574d843d9ec1f772f0"}, + {file = "coverage-5.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:66460ab1599d3cf894bb6baee8c684788819b71a5dc1e8fa2ecc152e5d752019"}, + {file = "coverage-5.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:5c542d1e62eece33c306d66fe0a5c4f7f7b3c08fecc46ead86d7916684b36d6c"}, + {file = "coverage-5.1-cp36-cp36m-win32.whl", hash = "sha256:2742c7515b9eb368718cd091bad1a1b44135cc72468c731302b3d641895b83d1"}, + {file = "coverage-5.1-cp36-cp36m-win_amd64.whl", hash = "sha256:dead2ddede4c7ba6cb3a721870f5141c97dc7d85a079edb4bd8d88c3ad5b20c7"}, + {file = "coverage-5.1-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:01333e1bd22c59713ba8a79f088b3955946e293114479bbfc2e37d522be03355"}, + {file = "coverage-5.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:e1ea316102ea1e1770724db01998d1603ed921c54a86a2efcb03428d5417e489"}, + {file = "coverage-5.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:adeb4c5b608574a3d647011af36f7586811a2c1197c861aedb548dd2453b41cd"}, + {file = "coverage-5.1-cp37-cp37m-win32.whl", hash = "sha256:782caea581a6e9ff75eccda79287daefd1d2631cc09d642b6ee2d6da21fc0a4e"}, + {file = "coverage-5.1-cp37-cp37m-win_amd64.whl", hash = "sha256:00f1d23f4336efc3b311ed0d807feb45098fc86dee1ca13b3d6768cdab187c8a"}, + {file = "coverage-5.1-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:402e1744733df483b93abbf209283898e9f0d67470707e3c7516d84f48524f55"}, + {file = "coverage-5.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:a3f3654d5734a3ece152636aad89f58afc9213c6520062db3978239db122f03c"}, + {file = "coverage-5.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:6402bd2fdedabbdb63a316308142597534ea8e1895f4e7d8bf7476c5e8751fef"}, + {file = "coverage-5.1-cp38-cp38-win32.whl", hash = "sha256:8fa0cbc7ecad630e5b0f4f35b0f6ad419246b02bc750de7ac66db92667996d24"}, + {file = "coverage-5.1-cp38-cp38-win_amd64.whl", hash = "sha256:79a3cfd6346ce6c13145731d39db47b7a7b859c0272f02cdb89a3bdcbae233a0"}, + {file = "coverage-5.1-cp39-cp39-win32.whl", hash = "sha256:a82b92b04a23d3c8a581fc049228bafde988abacba397d57ce95fe95e0338ab4"}, + {file = "coverage-5.1-cp39-cp39-win_amd64.whl", hash = "sha256:bb28a7245de68bf29f6fb199545d072d1036a1917dca17a1e75bbb919e14ee8e"}, + {file = "coverage-5.1.tar.gz", hash = "sha256:f90bfc4ad18450c80b024036eaf91e4a246ae287701aaa88eaebebf150868052"}, ] coveragespace = [ {file = "coveragespace-3.1.1-py3-none-any.whl", hash = "sha256:cc62bf4f2feb419032920270a0c16f1a379b80ac9fc6bd3cefce918bfc90ba27"}, {file = "coveragespace-3.1.1.tar.gz", hash = "sha256:c5862d04a91bec32fc7dd8487006922e144280dc05e75b26c38f4ffe4e760fb0"}, ] datafiles = [ - {file = "datafiles-0.9b5-py3-none-any.whl", hash = "sha256:2a6be82fa6de6fb31477108d3a8aa9862168de2a1369dba09a4ecbdf1621936d"}, - {file = "datafiles-0.9b5.tar.gz", hash = "sha256:9d455c9fbb6785161a85dc18a989cacff6c5ecb6a46452d763d7dc36da4bb3bd"}, + {file = "datafiles-0.9-py3-none-any.whl", hash = "sha256:ace4feb1a1c60c25682e57208bfe470efe6012205810ea3eb347c6f58ae86453"}, + {file = "datafiles-0.9.tar.gz", hash = "sha256:972ec2afec62fe156ea8c3ea6bdbf6285661fa589c4242257bcb68ad152cee11"}, ] dis3 = [ {file = "dis3-0.1.3-py2-none-any.whl", hash = "sha256:61f7720dd0d8749d23fda3d7227ce74d73da11c2fade993a67ab2f9852451b14"}, diff --git a/pyproject.toml b/pyproject.toml index f9af0fb4..82aa1660 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "2.0b3" +version = "2.0" description = "A language-agnostic dependency manager using Git." license = "MIT" @@ -42,7 +42,7 @@ classifiers = [ python = "^3.7" -datafiles = ">=0.9b5" +datafiles = ">=0.9" minilog = "^1.5" [tool.poetry.dev-dependencies]