~michel-slm/myrepos-utils

c16517229e60aa05a5d1997e7ae534271c6f7006 — Michel Alexandre Salim 4 months ago
Initial commit

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
A  => .gitignore +7 -0
@@ 1,7 @@
*.egg-info
.coverage
.venv*
__pycache__
build/
dist/


A  => Makefile +20 -0
@@ 1,20 @@
dist: myrepos_utils/*.py myrepos_utils/tests/*.py
	python -m build

black: myrepos_utils/*.py myrepos_utils/tests/*.py
	black $?

clean:
	rm -rf dist

install:
	pip install --force-reinstall dist/myrepos_utils*.whl

tarball:
	python -m build --sdist --wheel

covtest:
	pytest -v --cov=myrepos_utils --cov-report=term-missing

test:
	pytest -v

A  => myrepos_utils/__init__.py +15 -0
@@ 1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# (c) Michel Alexandre Salim
#
# Fedora-License-Identifier: GPLv2+
# SPDX-2.0-License-Identifier: GPL-2.0+
# SPDX-3.0-License-Identifier: GPL-2.0-or-later
#
# This program is free software.
# For more information on the license, see COPYING.md.
# For more information on free software, see
# <https://www.gnu.org/philosophy/free-sw.en.html>.

__version__ = "0.0.1.dev1"

A  => myrepos_utils/__main__.py +18 -0
@@ 1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# (c) Michel Alexandre Salim
#
# Fedora-License-Identifier: GPLv2+
# SPDX-2.0-License-Identifier: GPL-2.0+
# SPDX-3.0-License-Identifier: GPL-2.0-or-later
#
# This program is free software.
# For more information on the license, see COPYING.md.
# For more information on free software, see
# <https://www.gnu.org/philosophy/free-sw.en.html>.

from .cli import cli

if __name__ == "__main__":
    cli()

A  => myrepos_utils/cli.py +31 -0
@@ 1,31 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# (c) Michel Alexandre Salim
#
# Fedora-License-Identifier: GPLv2+
# SPDX-2.0-License-Identifier: GPL-2.0+
# SPDX-3.0-License-Identifier: GPL-2.0-or-later
#
# This program is free software.
# For more information on the license, see COPYING.md.
# For more information on free software, see
# <https://www.gnu.org/philosophy/free-sw.en.html>.

import click
import json
import sys
from . import utils


@click.group()
def cli():
    pass


@cli.command(help="cd to a directory tracked by myrepos")
@click.argument("paths", nargs=-1)
def cd(paths: list[str]):
    import os

    os.chdir(utils.find_dir(paths))

A  => myrepos_utils/tests/__init__.py +13 -0
@@ 1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# (c) Michel Alexandre Salim
#
# Fedora-License-Identifier: GPLv2+
# SPDX-2.0-License-Identifier: GPL-2.0+
# SPDX-3.0-License-Identifier: GPL-2.0-or-later
#
# This program is free software.
# For more information on the license, see COPYING.md.
# For more information on free software, see
# <https://www.gnu.org/philosophy/free-sw.en.html>.

A  => myrepos_utils/utils.py +16 -0
@@ 1,16 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# (c) Michel Alexandre Salim
#
# Fedora-License-Identifier: GPLv2+
# SPDX-2.0-License-Identifier: GPL-2.0+
# SPDX-3.0-License-Identifier: GPL-2.0-or-later
#
# This program is free software.
# For more information on the license, see COPYING.md.
# For more information on free software, see
# <https://www.gnu.org/philosophy/free-sw.en.html>.

def find_dir(paths: list[str], config = None):
    raise NotImplementedError

A  => pyproject.toml +4 -0
@@ 1,4 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"


A  => requirements-dev.txt +5 -0
@@ 1,5 @@
black
build
pip-tools
pytest
pytest-cov

A  => requirements-test.txt +1 -0
@@ 1,1 @@
pytest

A  => setup.cfg +35 -0
@@ 1,35 @@
[metadata]
name = myrepos-utils
version = attr: myrepos_utils.__version__
url = https://git.sr.ht/~michel-slm/myrepos-utils
author = Michel Alexandre Salim
author_email = michel@michel-slm.name
description = Additional utilities for myrepos
long_description = file: README.md
long_description_content_type = text/markdown
license = GPLv2+
classifiers =
  Development Status :: 3 - Alpha
  Environment :: Console
  License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)

[options]
install_requires =
  click
#setup_requires =
packages = find:
include_package_data = True

[options.entry_points]
console_scripts =
  mr-utils = myrepos_utils.cli:cli

[options.extras_require]
dev =
  black
  build
  pip-tools
  pytest
  pytest-cov
test =
  pytest