Skip to content

Commit

Permalink
Merge 738e942 into 6a9d11c
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Apr 4, 2020
2 parents 6a9d11c + 738e942 commit 1a4d0b2
Show file tree
Hide file tree
Showing 14 changed files with 316 additions and 251 deletions.
4 changes: 3 additions & 1 deletion .appveyor.yml
Expand Up @@ -6,11 +6,13 @@ environment:
PYTHON_MINOR: 6
- PYTHON_MAJOR: 3
PYTHON_MINOR: 7
- PYTHON_MAJOR: 3
PYTHON_MINOR: 8

cache:
- .venv -> poetry.lock

init:
init:
- git config --global core.symlinks true

install:
Expand Down
1 change: 1 addition & 0 deletions .python-version
@@ -0,0 +1 @@
3.8.2
7 changes: 0 additions & 7 deletions .scrutinizer.yml
Expand Up @@ -3,13 +3,6 @@ build:
override:
- pylint-run --rcfile=.pylint.ini
- py-scrutinizer-run
nodes:
py35:
environment:
python: 3.5.1
py36:
environment:
python: 3.6
checks:
python:
code_rating: true
Expand Down
9 changes: 4 additions & 5 deletions .travis.yml
@@ -1,11 +1,10 @@
dist: xenial

language: python
python:
- 3.6
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
- 3.7
- 3.8

cache:
pip: true
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# 1.8 (beta)

- Added support Python 3.8.

# 1.7 (2019-08-07)

- **BREAKING**: Renamed `-f` alias to `-F` (`-f` now implies `--force-interactive`).
Expand Down Expand Up @@ -173,8 +177,8 @@
# 0.1.2 (2014-02-27)

- Added `--force` argument to:
- overwrite uncommitted changes
- create symbolic links in place of directories
- overwrite uncommitted changes
- create symbolic links in place of directories
- Added live shell command output with `-vv` argument.

# 0.1 (2014-02-24)
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Expand Up @@ -45,7 +45,7 @@ DEPENDENCIES := $(VIRTUAL_ENV)/.poetry-$(shell bin/checksum pyproject.toml poetr
install: $(DEPENDENCIES) .cache

$(DEPENDENCIES): poetry.lock
@ poetry config virtualenvs.in-project true || poetry config settings.virtualenvs.in-project true
@ poetry config virtualenvs.in-project true
poetry install
@ touch $@

Expand All @@ -69,9 +69,9 @@ check: install format ## Run formaters, linters, and static analysis
ifdef CI
git diff --exit-code
endif
poetry run pylint $(PACKAGES) --rcfile=.pylint.ini
poetry run mypy $(PACKAGES) --config-file=.mypy.ini
poetry run pydocstyle $(PACKAGES) $(CONFIG)
poetry run mypy $(PACKAGES) --config-file=.mypy.ini
poetry run pylint $(PACKAGES) --rcfile=.pylint.ini

# TESTS #######################################################################

Expand Down Expand Up @@ -129,9 +129,9 @@ $(MKDOCS_INDEX): docs/requirements.txt mkdocs.yml docs/*.md
@ cd docs/about && ln -sf ../../LICENSE.md license.md
poetry run mkdocs build --clean --strict

# Workaround: https://github.com/rtfd/readthedocs.org/issues/5090
docs/requirements.txt: poetry.lock
@ poetry run pip freeze -qqq | grep mkdocs > $@
@ poetry run pip freeze -qqq | grep mkdocs > $@
@ poetry run pip freeze -qqq | grep Pygments >> $@

.PHONY: uml
uml: install docs/*.png
Expand Down
13 changes: 8 additions & 5 deletions bin/checksum
Expand Up @@ -6,14 +6,17 @@ import sys


def run(paths):
hash_md5 = hashlib.md5()
sha = hashlib.sha1()

for path in paths:
with open(path, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b''):
hash_md5.update(chunk)
try:
with open(path, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b''):
sha.update(chunk)
except IOError:
sha.update(path.encode())

print(hash_md5.hexdigest())
print(sha.hexdigest())


if __name__ == '__main__':
Expand Down
32 changes: 27 additions & 5 deletions bin/verchew
Expand Up @@ -43,15 +43,17 @@ try:
except ImportError:
import ConfigParser as configparser # Python 2

__version__ = '1.5'
__version__ = '1.6.2'

PY2 = sys.version_info[0] == 2

CONFIG_FILENAMES = [
'verchew.ini',
'.verchew.ini',
'.verchewrc',
'.verchew',
]

SAMPLE_CONFIG = """
[Python]
Expand All @@ -76,12 +78,14 @@ version = GNU Make
optional = true
""".strip()

STYLE = {
"~": "✔",
"*": "⭑",
"?": "⚠",
"x": "✘",
}

COLOR = {
"x": "\033[91m", # red
"~": "\033[92m", # green
Expand All @@ -90,12 +94,18 @@ COLOR = {
None: "\033[0m", # reset
}

QUIET = False

log = logging.getLogger(__name__)


def main():
global QUIET

args = parse_args()
configure_logging(args.verbose)
if args.quiet:
QUIET = True

log.debug("PWD: %s", os.getenv('PWD'))
log.debug("PATH: %s", os.getenv('PATH'))
Expand All @@ -118,8 +128,12 @@ def parse_args():
help="generate a sample configuration file")
parser.add_argument('--exit-code', action='store_true',
help="return a non-zero exit code on failure")
parser.add_argument('-v', '--verbose', action='count', default=0,
help="enable verbose logging")

group = parser.add_mutually_exclusive_group()
group.add_argument('-v', '--verbose', action='count', default=0,
help="enable verbose logging")
group.add_argument('-q', '--quiet', action='store_true',
help="suppress all output on success")

args = parser.parse_args()

Expand Down Expand Up @@ -208,6 +222,11 @@ def check_dependencies(config):
show(_("?") + " EXPECTED: {0}".format(settings['versions']))
success.append(_("?"))
else:
if QUIET:
print("Unmatched {0} version: {1}".format(
name,
settings['versions'],
))
show(_("x") + " EXPECTED: {0}".format(settings['versions']))
success.append(_("x"))
if settings.get('message'):
Expand All @@ -228,13 +247,13 @@ def get_version(program, argument=None):

show("$ {0}".format(" ".join(args)))
output = call(args)
show(output.splitlines()[0])
show(output.splitlines()[0] if output else "<nothing>")

return output


def match_version(pattern, output):
regex = pattern.replace('.', r'\.') + r'\b'
regex = pattern.replace('.', r'\.') + r'(\b|/)'

log.debug("Matching %s: %s", regex, output)
match = re.match(regex, output)
Expand All @@ -260,6 +279,9 @@ def call(args):

def show(text, start='', end='\n', head=False):
"""Python 2 and 3 compatible version of print."""
if QUIET:
return

if head:
start = '\n'
end = '\n\n'
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
@@ -1 +1,2 @@
mkdocs==1.0.4
Pygments==2.6.1
7 changes: 4 additions & 3 deletions gitman/common.py
@@ -1,6 +1,7 @@
"""Common exceptions, classes, and functions."""

import argparse
import logging
import os
import sys

Expand All @@ -17,7 +18,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class WarningFormatter(log.logging.Formatter):
class WarningFormatter(logging.Formatter):
"""Logging formatter that displays verbose formatting for WARNING+."""

def __init__(self, default_format, verbose_format, *args, **kwargs):
Expand Down Expand Up @@ -80,11 +81,11 @@ def configure_logging(count=0):
# Set a custom formatter
log.init(level=level)
log.silence('yorm', allow_warning=True)
log.logging.captureWarnings(True)
logging.captureWarnings(True)
formatter = WarningFormatter(
default_format, verbose_format, datefmt=settings.LOGGING_DATEFMT
)
log.logging.root.handlers[0].setFormatter(formatter)
logging.root.handlers[0].setFormatter(formatter)

# Warn about excessive verbosity
if count > _Config.MAX_VERBOSITY:
Expand Down
45 changes: 22 additions & 23 deletions mkdocs.yml
Expand Up @@ -8,28 +8,27 @@ edit_uri: https://github.com/jacebrowning/gitman/edit/develop/docs
theme: readthedocs

markdown_extensions:
- codehilite:
linenums: True
- codehilite

nav:
- Home: index.md
- Setup:
- Git: setup/git.md
- Git SVN: setup/git-svn.md
- Environment: setup/environment.md
- Interfaces:
- Command Line: interfaces/cli.md
- Git Plugin: interfaces/plugin.md
- Package API: interfaces/api.md
- Use Cases:
- Replacing Submodules: use-cases/submodules.md
- Tracking Branches: use-cases/branch-tracking.md
- Linking Feature Branches: use-cases/linked-features.md
- Build System Integration: use-cases/build-integration.md
- Self contained GitMan: use-cases/self-contained-gitman.md
- Sparse Checkouts: use-cases/sparse-checkouts.md
- Git SVN: use-cases/git-svn.md
- About:
- Release Notes: about/changelog.md
- Contributing: about/contributing.md
- License: about/license.md
- Home: index.md
- Setup:
- Git: setup/git.md
- Git SVN: setup/git-svn.md
- Environment: setup/environment.md
- Interfaces:
- Command Line: interfaces/cli.md
- Git Plugin: interfaces/plugin.md
- Package API: interfaces/api.md
- Use Cases:
- Replacing Submodules: use-cases/submodules.md
- Tracking Branches: use-cases/branch-tracking.md
- Linking Feature Branches: use-cases/linked-features.md
- Build System Integration: use-cases/build-integration.md
- Self contained GitMan: use-cases/self-contained-gitman.md
- Sparse Checkouts: use-cases/sparse-checkouts.md
- Git SVN: use-cases/git-svn.md
- About:
- Release Notes: about/changelog.md
- Contributing: about/contributing.md
- License: about/license.md

0 comments on commit 1a4d0b2

Please sign in to comment.