diff --git a/apt_ostree/cmd/__init__.py b/apt_ostree/cmd/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apt_ostree/cmd/shell.py b/apt_ostree/cmd/shell.py new file mode 100644 index 0000000..c0b0cf6 --- /dev/null +++ b/apt_ostree/cmd/shell.py @@ -0,0 +1,25 @@ +""" +Copyright (c) 2023 Wind River Systems, Inc. + +SPDX-License-Identifier: Apache-2.0 + +""" + +import click + +from apt_ostree.cmd.version import version + + +@click.group( + help="\nHyrbid image/package management system." +) +@click.pass_context +def cli(ctx: click.Context): + ctx.ensure_object(dict) + + +def main(): + cli(prog_name="apt-ostree") + + +cli.add_command(version) diff --git a/apt_ostree/cmd/version.py b/apt_ostree/cmd/version.py new file mode 100644 index 0000000..30aef00 --- /dev/null +++ b/apt_ostree/cmd/version.py @@ -0,0 +1,16 @@ +""" +Copyright (c) 2023 Wind River Systems, Inc. + +SPDX-License-Identifier: Apache-2.0 + +""" + +import click + +from apt_ostree.constants import VERSION + + +@click.command(name="version", help="Show version and exit.") +@click.pass_context +def version(ctxt): + print(VERSION) diff --git a/apt_ostree/constants.py b/apt_ostree/constants.py new file mode 100644 index 0000000..61f0bf9 --- /dev/null +++ b/apt_ostree/constants.py @@ -0,0 +1,8 @@ +""" +Copyright (c) 2023 Wind River Systems, Inc. + +SPDX-License-Identifier: Apache-2.0 + +""" + +VERSION = "0.1" diff --git a/apt_ostree/tests/test_apt_ostree.py b/apt_ostree/tests/test_apt_ostree.py deleted file mode 100644 index 6eca451..0000000 --- a/apt_ostree/tests/test_apt_ostree.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -test_apt_ostree ----------------------------------- - -Tests for `apt_ostree` module. -""" - -from apt_ostree.tests import base - - -class TestApt_ostree(base.TestCase): - - def test_something(self): - pass diff --git a/apt_ostree/tests/test_cli.py b/apt_ostree/tests/test_cli.py new file mode 100644 index 0000000..dd6e0c4 --- /dev/null +++ b/apt_ostree/tests/test_cli.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from apt_ostree.tests import base +from apt_ostree.cmd.shell import cli +from click.testing import CliRunner + + +class Test_apt_cli(base.TestCase): + + def test_something(self): + runner = CliRunner() + result = runner.invoke(cli, ["version"]) + assert result.exit_code == 0 diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 6e6bbc8..570a331 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -57,7 +57,7 @@ copyright = '2022, OpenStack Developers' # openstackdocstheme options openstackdocs_repo_name = 'starlingx/apt-ostree' -openstackdocs_bug_project = 'replace with the name of the project on Launchpad or the ID from Storyboard' +openstackdocs_bug_project = '' openstackdocs_bug_tag = '' openstackdocs_auto_name = 'False' diff --git a/setup.cfg b/setup.cfg index 39ea059..bd9b8c6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,6 +21,10 @@ classifier = Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython +[entry_points] +console_scripts = + apt-ostree = apt_ostree.cmd.shell:main + [files] packages = apt_ostree diff --git a/test-requirements.txt b/test-requirements.txt index f09cf7f..6bb1ea7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,3 +9,4 @@ python-subunit>=0.0.18 # Apache-2.0/BSD oslotest>=1.10.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 testtools>=1.4.0 # MIT +click