Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ Installation of the latest development version:
pip install https://github.com/python-distro/distro/archive/master.tar.gz
```

To use as a standalone script, download `distro.py` directly:

```shell
curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py
python distro.py
```

``distro`` is safe to vendor within projects that do not wish to add
dependencies.

```shell
cd myproject
curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py
```

## Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

# The short X.Y version.
# Note: We use the full version in both cases.
version = distro.__version__
version = distro.__version__ # type: ignore

# The full version, including alpha/beta/rc tags
release = distro.__version__
release = version


# -- General configuration ---------------------------------------------------
Expand Down
9 changes: 7 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ classifiers =
Topic :: System :: Operating System

[options]
py_modules = distro
package_dir =
= src
packages = distro
python_requires = >=3.6

[options.package_data]
* = py.typed

[options.entry_points]
console_scripts =
distro = distro:main
distro = distro.distro:main

[flake8]
max-line-length = 88
Expand Down
54 changes: 54 additions & 0 deletions src/distro/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from .distro import (
NORMALIZED_DISTRO_ID,
NORMALIZED_LSB_ID,
NORMALIZED_OS_ID,
LinuxDistribution,
__version__,
build_number,
codename,
distro_release_attr,
distro_release_info,
id,
info,
like,
linux_distribution,
lsb_release_attr,
lsb_release_info,
major_version,
minor_version,
name,
os_release_attr,
os_release_info,
uname_attr,
uname_info,
version,
version_parts,
)

__all__ = [
"NORMALIZED_DISTRO_ID",
"NORMALIZED_LSB_ID",
"NORMALIZED_OS_ID",
"LinuxDistribution",
"build_number",
"codename",
"distro_release_attr",
"distro_release_info",
"id",
"info",
"like",
"linux_distribution",
"lsb_release_attr",
"lsb_release_info",
"major_version",
"minor_version",
"name",
"os_release_attr",
"os_release_info",
"uname_attr",
"uname_info",
"version",
"version_parts",
]

__version__ = __version__
4 changes: 4 additions & 0 deletions src/distro/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .distro import main

if __name__ == "__main__":
main()
File renamed without changes.
Empty file added src/distro/py.typed
Empty file.
2 changes: 1 addition & 1 deletion tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

IS_LINUX = sys.platform.startswith("linux")
if IS_LINUX:
import distro
from distro import distro

RELATIVE_UNIXCONFDIR = distro._UNIXCONFDIR[1:]
RELATIVE_UNIXUSRLIBDIR = distro._UNIXUSRLIBDIR[1:]
Expand Down