diff --git a/README.md b/README.md deleted file mode 100644 index 9078b9e..0000000 --- a/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Software Heritage virtual file system -===================================== - -Virtual file system to browse the -[Software Heritage](https://www.softwareheritage.org/) [archive](https://archive.softwareheritage.org/), -built on top of [FUSE](https://github.com/libfuse/libfuse). diff --git a/README.rst b/README.rst new file mode 120000 index 0000000..cffceba --- /dev/null +++ b/README.rst @@ -0,0 +1 @@ +docs/README.rst \ No newline at end of file diff --git a/docs/README.rst b/docs/README.rst new file mode 100644 index 0000000..ef841fb --- /dev/null +++ b/docs/README.rst @@ -0,0 +1,7 @@ +Software Heritage - Virtual file system +======================================= + +Virtual file system to browse the +`Software Heritage `_ +`archive `_, +using the `FUSE `_ framework. diff --git a/docs/cli.rst b/docs/cli.rst new file mode 100644 index 0000000..b1b8c30 --- /dev/null +++ b/docs/cli.rst @@ -0,0 +1,6 @@ +Command-line interface +====================== + +.. click:: swh.fuse.cli:cli + :prog: swh fuse + :show-nested: diff --git a/docs/index.rst b/docs/index.rst index b04a56d..b9ff08d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,19 +1,11 @@ -.. _swh-py-template: +.. _swh-fuse: -Software Heritage - Python module template -========================================== - -Python module template, used as skeleton to create new modules. +.. include:: README.rst .. toctree:: - :maxdepth: 2 - :caption: Contents: - - -Indices and tables -================== + :maxdepth: 1 + :caption: Overview -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + cli + /apidoc/swh.fuse diff --git a/requirements-test.txt b/requirements-test.txt index 93e9270..47a5ba9 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,2 @@ pytest - -# XXX not actually needed -# XXX just a temporary workaround for https://forge.softwareheritage.org/T2634 -requests +requests # workaround for https://forge.softwareheritage.org/T2634 diff --git a/setup.py b/setup.py index 0d8e0fa..764cc59 100755 --- a/setup.py +++ b/setup.py @@ -1,71 +1,71 @@ #!/usr/bin/env python3 # Copyright (C) 2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information from io import open from os import path from setuptools import find_packages, setup here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, "README.md"), encoding="utf-8") as f: +with open(path.join(here, "README.rst"), encoding="utf-8") as f: long_description = f.read() def parse_requirements(name=None): if name: reqf = "requirements-%s.txt" % name else: reqf = "requirements.txt" requirements = [] if not path.exists(reqf): return requirements with open(reqf) as f: for line in f.readlines(): line = line.strip() if not line or line.startswith("#"): continue requirements.append(line) return requirements setup( name="swh.fuse", description="Software Heritage virtual file system", long_description=long_description, - long_description_content_type="text/markdown", + long_description_content_type="text/x-rst", python_requires=">=3.7", author="Software Heritage developers", author_email="swh-devel@inria.fr", url="https://forge.softwareheritage.org/source/swh-fuse", packages=find_packages(), # packages's modules install_requires=parse_requirements() + parse_requirements("swh"), tests_require=parse_requirements("test"), setup_requires=["setuptools-scm"], use_scm_version=True, extras_require={"testing": parse_requirements("test")}, include_package_data=True, entry_points=""" [swh.cli.subcommands] - fuse=swh.fuse.cli:fuse + fuse=swh.fuse.cli:cli """, classifiers=[ "Programming Language :: Python :: 3", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Development Status :: 3 - Alpha", ], project_urls={ "Bug Reports": "https://forge.softwareheritage.org/maniphest", "Funding": "https://www.softwareheritage.org/donate", "Source": "https://forge.softwareheritage.org/source/swh-fuse", "Documentation": "https://docs.softwareheritage.org/devel/swh-fuse/", }, ) diff --git a/swh/fuse/cli.py b/swh/fuse/cli.py index 35b4c73..25e1582 100644 --- a/swh/fuse/cli.py +++ b/swh/fuse/cli.py @@ -1,66 +1,66 @@ # Copyright (C) 2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information # WARNING: do not import unnecessary things here to keep cli startup time under # control import os from typing import Any, Dict import click # from swh.core import config from swh.core.cli import CONTEXT_SETTINGS # All generic config code should reside in swh.core.config DEFAULT_CONFIG_PATH = os.environ.get( "SWH_CONFIG_FILE", os.path.join(click.get_app_dir("swh"), "global.yml") ) DEFAULT_CONFIG: Dict[str, Any] = { "web-api": { "url": "https://archive.softwareheritage.org/api/1", "auth-token": None, } } @click.group(name="fuse", context_settings=CONTEXT_SETTINGS) # XXX conffile logic temporarily commented out due to: # XXX https://forge.softwareheritage.org/T2632 # @click.option( # "-C", # "--config-file", # default=DEFAULT_CONFIG_PATH, # type=click.Path(exists=True, dir_okay=False, path_type=str), # help="YAML configuration file", # ) @click.pass_context -def fuse(ctx): +def cli(ctx): """Software Heritage virtual file system""" # # recursive merge not done by config.read # conf = config.read_raw_config(config.config_basepath(config_file)) # conf = config.merge_configs(DEFAULT_CONFIG, conf) conf = {} ctx.ensure_object(dict) ctx.obj["config"] = conf -@fuse.command() +@cli.command() @click.option( "-u", "--api-url", default=DEFAULT_CONFIG["web-api"]["url"], metavar="API_URL", show_default=True, help="base URL for Software Heritage Web API", ) @click.pass_context def mount(ctx, api_url): """Mount the Software Heritage archive at the given mount point""" from .fuse import fuse # XXX fuse()