mirror of
https://github.com/containers/podman.git
synced 2025-06-18 15:39:08 +08:00
[WIP] Refactor and simplify python builds
* pypodman namespaced in site-packages * version numbers pulled from requirements.txt * add python-podman spec file to install eggs Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #1106 Approved by: rhatdan
This commit is contained in:
22
Makefile
22
Makefile
@ -87,6 +87,9 @@ endif
|
|||||||
lint: .gopathok varlink_generate
|
lint: .gopathok varlink_generate
|
||||||
@echo "checking lint"
|
@echo "checking lint"
|
||||||
@./.tool/lint
|
@./.tool/lint
|
||||||
|
# Not ready
|
||||||
|
# @$(MAKE) -C contrib/python/podman lint
|
||||||
|
# @$(MAKE) -C contrib/python/pypodman lint
|
||||||
|
|
||||||
gofmt:
|
gofmt:
|
||||||
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
|
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
|
||||||
@ -112,13 +115,9 @@ bin/podman.cross.%: .gopathok
|
|||||||
GOARCH="$${TARGET##*.}" \
|
GOARCH="$${TARGET##*.}" \
|
||||||
$(GO) build -i -ldflags '$(LDFLAGS_PODMAN)' -tags '$(BUILDTAGS_CROSS)' -o "$@" $(PROJECT)/cmd/podman
|
$(GO) build -i -ldflags '$(LDFLAGS_PODMAN)' -tags '$(BUILDTAGS_CROSS)' -o "$@" $(PROJECT)/cmd/podman
|
||||||
|
|
||||||
python-podman:
|
python:
|
||||||
ifdef HAS_PYTHON3
|
ifdef HAS_PYTHON3
|
||||||
$(MAKE) -C contrib/python/podman python-podman
|
$(MAKE) -C contrib/python/podman python-podman
|
||||||
endif
|
|
||||||
|
|
||||||
python-pypodman:
|
|
||||||
ifdef HAS_PYTHON3
|
|
||||||
$(MAKE) -C contrib/python/pypodman python-pypodman
|
$(MAKE) -C contrib/python/pypodman python-pypodman
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -181,7 +180,7 @@ clientintegration:
|
|||||||
vagrant-check:
|
vagrant-check:
|
||||||
BOX=$(BOX) sh ./vagrant.sh
|
BOX=$(BOX) sh ./vagrant.sh
|
||||||
|
|
||||||
binaries: varlink_generate podman python-podman python-pypodman
|
binaries: varlink_generate podman python
|
||||||
|
|
||||||
test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp
|
test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp
|
||||||
|
|
||||||
@ -206,7 +205,7 @@ changelog:
|
|||||||
$(shell cat $(TMPFILE) >> changelog.txt)
|
$(shell cat $(TMPFILE) >> changelog.txt)
|
||||||
$(shell rm $(TMPFILE))
|
$(shell rm $(TMPFILE))
|
||||||
|
|
||||||
install: .gopathok install.bin install.man install.cni install.systemd
|
install: .gopathok install.bin install.man install.cni install.systemd install.python
|
||||||
|
|
||||||
install.bin:
|
install.bin:
|
||||||
install ${SELINUXOPT} -D -m 755 bin/podman $(BINDIR)/podman
|
install ${SELINUXOPT} -D -m 755 bin/podman $(BINDIR)/podman
|
||||||
@ -242,6 +241,10 @@ install.systemd:
|
|||||||
install ${SELINUXOPT} -m 644 -D contrib/varlink/io.projectatomic.podman.service ${SYSTEMDDIR}/io.projectatomic.podman.service
|
install ${SELINUXOPT} -m 644 -D contrib/varlink/io.projectatomic.podman.service ${SYSTEMDDIR}/io.projectatomic.podman.service
|
||||||
install ${SELINUXOPT} -m 644 -D contrib/varlink/podman.conf ${TMPFILESDIR}/podman.conf
|
install ${SELINUXOPT} -m 644 -D contrib/varlink/podman.conf ${TMPFILESDIR}/podman.conf
|
||||||
|
|
||||||
|
install.python:
|
||||||
|
$(MAKE) -C contrib/python/podman install
|
||||||
|
$(MAKE) -C contrib/python/pypodman install
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for i in $(filter %.1,$(MANPAGES)); do \
|
for i in $(filter %.1,$(MANPAGES)); do \
|
||||||
rm -f $(MANDIR)/man1/$$(basename $${i}); \
|
rm -f $(MANDIR)/man1/$$(basename $${i}); \
|
||||||
@ -249,6 +252,8 @@ uninstall:
|
|||||||
for i in $(filter %.5,$(MANPAGES)); do \
|
for i in $(filter %.5,$(MANPAGES)); do \
|
||||||
rm -f $(MANDIR)/man5/$$(basename $${i}); \
|
rm -f $(MANDIR)/man5/$$(basename $${i}); \
|
||||||
done
|
done
|
||||||
|
$(MAKE) -C contrib/python/pypodman uninstall
|
||||||
|
$(MAKE) -C contrib/python/podman uninstall
|
||||||
|
|
||||||
.PHONY: .gitvalidation
|
.PHONY: .gitvalidation
|
||||||
.gitvalidation: .gopathok
|
.gitvalidation: .gopathok
|
||||||
@ -319,6 +324,5 @@ validate: gofmt .gitvalidation
|
|||||||
changelog \
|
changelog \
|
||||||
validate \
|
validate \
|
||||||
install.libseccomp.sudo \
|
install.libseccomp.sudo \
|
||||||
python-podman \
|
python \
|
||||||
python-pypodman \
|
|
||||||
clientintegration
|
clientintegration
|
||||||
|
@ -2,7 +2,11 @@ PYTHON ?= /usr/bin/python3
|
|||||||
|
|
||||||
.PHONY: python-podman
|
.PHONY: python-podman
|
||||||
python-podman:
|
python-podman:
|
||||||
$(PYTHON) setup.py bdist
|
$(PYTHON) setup.py sdist bdist
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
$(PYTHON) -m pylint podman
|
||||||
|
|
||||||
.PHONY: integration
|
.PHONY: integration
|
||||||
integration:
|
integration:
|
||||||
@ -10,12 +14,18 @@ integration:
|
|||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
$(PYTHON) setup.py install --user
|
$(PYTHON) setup.py install
|
||||||
|
|
||||||
|
.PHONY: clobber
|
||||||
|
clobber: uninstall clean
|
||||||
|
|
||||||
|
.PHONY: uninstall
|
||||||
|
uninstall:
|
||||||
|
$(PYTHON) -m pip uninstall --yes podman ||:
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(PYTHON) setup.py clean --all
|
$(PYTHON) setup.py clean --all
|
||||||
pip3 uninstall podman ||:
|
|
||||||
rm -rf podman.egg-info dist
|
rm -rf podman.egg-info dist
|
||||||
find . -depth -name __pycache__ -exec rm -rf {} \;
|
find . -depth -name __pycache__ -exec rm -rf {} \;
|
||||||
find . -depth -name \*.pyc -exec rm -f {} \;
|
find . -depth -name \*.pyc -exec rm -f {} \;
|
||||||
|
@ -6,11 +6,12 @@ See [libpod](https://github.com/projectatomic/libpod)
|
|||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
To build the podman egg:
|
To build the podman egg and install as user:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ~/libpod/contrib/python
|
cd ~/libpod/contrib/python/podman
|
||||||
python3 setup.py clean -a && python3 setup.py bdist
|
python3 setup.py clean -a && python3 setup.py sdist bdist
|
||||||
|
python3 setup.py install --user
|
||||||
```
|
```
|
||||||
|
|
||||||
## Code snippets/examples:
|
## Code snippets/examples:
|
||||||
|
@ -4,7 +4,7 @@ import pkg_resources
|
|||||||
from .client import Client
|
from .client import Client
|
||||||
from .libs import datetime_format, datetime_parse
|
from .libs import datetime_format, datetime_parse
|
||||||
from .libs.errors import (ContainerNotFound, ErrorOccurred, ImageNotFound,
|
from .libs.errors import (ContainerNotFound, ErrorOccurred, ImageNotFound,
|
||||||
RuntimeError)
|
PodmanError)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
__version__ = pkg_resources.get_distribution('podman').version
|
__version__ = pkg_resources.get_distribution('podman').version
|
||||||
@ -18,5 +18,5 @@ __all__ = [
|
|||||||
'datetime_parse',
|
'datetime_parse',
|
||||||
'ErrorOccurred',
|
'ErrorOccurred',
|
||||||
'ImageNotFound',
|
'ImageNotFound',
|
||||||
'RuntimeError',
|
'PodmanError',
|
||||||
]
|
]
|
||||||
|
@ -43,7 +43,7 @@ class ErrorOccurred(VarlinkErrorProxy):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class RuntimeError(VarlinkErrorProxy):
|
class PodmanError(VarlinkErrorProxy):
|
||||||
"""Raised when Client fails to connect to runtime."""
|
"""Raised when Client fails to connect to runtime."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
@ -53,7 +53,7 @@ error_map = {
|
|||||||
'io.projectatomic.podman.ContainerNotFound': ContainerNotFound,
|
'io.projectatomic.podman.ContainerNotFound': ContainerNotFound,
|
||||||
'io.projectatomic.podman.ErrorOccurred': ErrorOccurred,
|
'io.projectatomic.podman.ErrorOccurred': ErrorOccurred,
|
||||||
'io.projectatomic.podman.ImageNotFound': ImageNotFound,
|
'io.projectatomic.podman.ImageNotFound': ImageNotFound,
|
||||||
'io.projectatomic.podman.RuntimeError': RuntimeError,
|
'io.projectatomic.podman.RuntimeError': PodmanError,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
varlink>=26.1.0
|
python-dateutil
|
||||||
setuptools>=39.2.0
|
setuptools>=39
|
||||||
python-dateutil>=2.7.3
|
varlink
|
||||||
|
@ -15,24 +15,22 @@ with open(os.path.join(root, 'requirements.txt')) as r:
|
|||||||
setup(
|
setup(
|
||||||
name='podman',
|
name='podman',
|
||||||
version=os.environ.get('PODMAN_VERSION', '0.0.0'),
|
version=os.environ.get('PODMAN_VERSION', '0.0.0'),
|
||||||
description='A client for communicating with a Podman server',
|
description='A library for communicating with a Podman server',
|
||||||
long_description=readme,
|
|
||||||
author='Jhon Honce',
|
author='Jhon Honce',
|
||||||
author_email='jhonce@redhat.com',
|
author_email='jhonce@redhat.com',
|
||||||
url='http://github.com/projectatomic/libpod',
|
|
||||||
license='Apache Software License',
|
license='Apache Software License',
|
||||||
python_requires='>=3',
|
long_description=readme,
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
packages=find_packages(exclude=['test']),
|
packages=find_packages(exclude=['test']),
|
||||||
|
python_requires='>=3',
|
||||||
zip_safe=True,
|
zip_safe=True,
|
||||||
|
url='http://github.com/projectatomic/libpod',
|
||||||
keywords='varlink libpod podman',
|
keywords='varlink libpod podman',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 3 - Alpha',
|
'Development Status :: 3 - Alpha',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'Topic :: Software Development',
|
|
||||||
'License :: OSI Approved :: Apache Software License',
|
'License :: OSI Approved :: Apache Software License',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Topic :: Software Development',
|
||||||
])
|
])
|
||||||
# Not supported
|
|
||||||
# long_description_content_type='text/markdown',
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
prune test/
|
||||||
include README.md
|
include README.md
|
||||||
|
@ -2,7 +2,11 @@ PYTHON ?= /usr/bin/python3
|
|||||||
|
|
||||||
.PHONY: python-pypodman
|
.PHONY: python-pypodman
|
||||||
python-pypodman:
|
python-pypodman:
|
||||||
$(PYTHON) setup.py bdist
|
$(PYTHON) setup.py sdist bdist
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
$(PYTHON) -m pylint pypodman
|
||||||
|
|
||||||
.PHONY: integration
|
.PHONY: integration
|
||||||
integration:
|
integration:
|
||||||
@ -10,12 +14,17 @@ integration:
|
|||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
$(PYTHON) setup.py install --user
|
$(PYTHON) setup.py install
|
||||||
|
|
||||||
|
.PHONY: clobber
|
||||||
|
clobber: uninstall clean
|
||||||
|
|
||||||
|
.PHONY: uninstall
|
||||||
|
$(PYTHON) -m pip uninstall --yes pypodman ||:
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(PYTHON) setup.py clean --all
|
$(PYTHON) setup.py clean --all
|
||||||
pip3 uninstall pypodman ||:
|
|
||||||
rm -rf pypodman.egg-info dist
|
rm -rf pypodman.egg-info dist
|
||||||
find . -depth -name __pycache__ -exec rm -rf {} \;
|
find . -depth -name __pycache__ -exec rm -rf {} \;
|
||||||
find . -depth -name \*.pyc -exec rm -f {} \;
|
find . -depth -name \*.pyc -exec rm -f {} \;
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
# pypodman - CLI interface for podman written in python
|
# pypodman - CLI for podman written in python
|
||||||
|
|
||||||
## Status: Active Development
|
## Status: Active Development
|
||||||
|
|
||||||
See [libpod](https://github.com/projectatomic/libpod/contrib/python/cmd)
|
See [libpod](https://github.com/projectatomic/libpod/contrib/python/pypodman)
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
To build the pypodman egg:
|
To build the pypodman egg and install as user:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ~/libpod/contrib/python/cmd
|
cd ~/libpod/contrib/python/pypodman
|
||||||
python3 setup.py clean -a && python3 setup.py bdist
|
python3 setup.py clean -a && python3 setup.py sdist bdist
|
||||||
|
python3 setup.py install --user
|
||||||
```
|
```
|
||||||
|
Add `~/.local/bin` to your `PATH` to run pypodman command.
|
||||||
|
|
||||||
## Running command:
|
## Running command:
|
||||||
|
|
||||||
|
96
contrib/python/pypodman/docs/man1/pypodman.1
Normal file
96
contrib/python/pypodman/docs/man1/pypodman.1
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
.TH pypodman 1 2018-07-20 0.7.3
|
||||||
|
.SH NAME
|
||||||
|
pypodman \- CLI management tool for containers and images
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\f[B]pypodman\f[] [\f[I]global options\f[]] \f[I]command\f[] [\f[I]options\f[]]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
pypodman is a simple client only tool to help with debugging issues when daemons
|
||||||
|
such as CRI runtime and the kubelet are not responding or failing.
|
||||||
|
.P
|
||||||
|
pypodman uses a VarLink API to commicate with a podman service running on either
|
||||||
|
the local or remote machine. pypodman uses ssh to create secure tunnels when
|
||||||
|
communicating with a remote service.
|
||||||
|
.SH GLOBAL OPTIONS
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]help, \-h\f[]
|
||||||
|
.PP
|
||||||
|
Print usage statement.
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]version\f[]
|
||||||
|
.PP
|
||||||
|
Print program version number and exit.
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]config\-home\f[]
|
||||||
|
.PP
|
||||||
|
Directory that will be namespaced with \f[C]pypodman\f[] to hold
|
||||||
|
\f[C]pypodman.conf\f[].
|
||||||
|
See FILES below for more details.
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]log\-level\f[]
|
||||||
|
.PP
|
||||||
|
Log events above specified level: DEBUG, INFO, WARNING (default), ERROR,
|
||||||
|
or CRITICAL.
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]run\-dir\f[]
|
||||||
|
.PP
|
||||||
|
Directory that will be namespaced with \f[C]pypodman\f[] to hold local socket
|
||||||
|
bindings. The default is `\f[C]$XDG_RUNTIME_DIR\\\f[].
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]user\f[]
|
||||||
|
.PP
|
||||||
|
Authenicating user on remote host. \f[C]pypodman\f[] defaults to the logged in
|
||||||
|
user.
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]host\f[]
|
||||||
|
.PP
|
||||||
|
Name of remote host. There is no default, if not given \f[C]pypodman\f[]
|
||||||
|
attempts to connect to \f[C]\-\-remote\-socket\-path\f[] on local host.
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]remote\-socket\-path\f[]
|
||||||
|
.PP
|
||||||
|
Path on remote host for podman service's \f[C]AF_UNIX\f[] socket. The default is
|
||||||
|
\f[C]/run/podman/io.projectatomic.podman\f[].
|
||||||
|
.PP
|
||||||
|
\f[B]\[en]identity\-file\f[]
|
||||||
|
.PP
|
||||||
|
The optional \f[C]ssh\f[] identity file to authenicate when tunnelling to remote
|
||||||
|
host. Default is None and will allow \f[C]ssh\f[] to follow it's default methods
|
||||||
|
for resolving the identity and private key using the logged in user.
|
||||||
|
.SH COMMANDS
|
||||||
|
.PP
|
||||||
|
See podman(1) (podman.1.md)
|
||||||
|
.SH FILES
|
||||||
|
.PP
|
||||||
|
\f[B]pypodman/pypodman.conf\f[]
|
||||||
|
(\f[C]Any\ element\ of\ XDG_CONFIG_DIRS\f[] and/or
|
||||||
|
\f[C]XDG_CONFIG_HOME\f[] and/or \f[B]\[en]config\-home\f[])
|
||||||
|
.PP
|
||||||
|
pypodman.conf is one or more configuration files for running the pypodman
|
||||||
|
command. pypodman.conf is a TOML file with the stanza \f[C][default]\f[], with a
|
||||||
|
map of \f[C]option: value\f[].
|
||||||
|
.PP
|
||||||
|
pypodman follows the XDG (freedesktop.org) conventions for resolving it's
|
||||||
|
configuration. The list below are read from top to bottom with later items
|
||||||
|
overwriting earlier. Any missing items are ignored.
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[C]pypodman/pypodman.conf\f[] from any path element in
|
||||||
|
\f[C]XDG_CONFIG_DIRS\f[] or \f[C]\\etc\\xdg\f[]
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[C]XDG_CONFIG_HOME\f[] or $HOME/.config + \f[C]pypodman/pypodman.conf\f[]
|
||||||
|
.IP \[bu] 2
|
||||||
|
From \f[C]\-\-config\-home\f[] command line option + \f[C]pypodman/pypodman.conf\f[]
|
||||||
|
.IP \[bu] 2
|
||||||
|
From environment variable, for example: RUN_DIR
|
||||||
|
.IP \[bu] 2
|
||||||
|
From command line option, for example: \[en]run\-dir
|
||||||
|
.PP
|
||||||
|
This should provide Operators the ability to setup basic configurations
|
||||||
|
and allow users to customize them.
|
||||||
|
.PP
|
||||||
|
\f[B]XDG_RUNTIME_DIR\f[] (\f[C]XDG_RUNTIME_DIR/io.projectatomic.podman\f[])
|
||||||
|
.PP
|
||||||
|
Directory where pypodman stores non\-essential runtime files and other file
|
||||||
|
objects (such as sockets, named pipes, \&...).
|
||||||
|
.SH SEE ALSO
|
||||||
|
.PP
|
||||||
|
\f[C]podman(1)\f[], \f[C]libpod(8)\f[]
|
@ -1,82 +0,0 @@
|
|||||||
% pypodman "1"
|
|
||||||
|
|
||||||
## NAME
|
|
||||||
|
|
||||||
pypodman - Simple management tool for containers and images
|
|
||||||
|
|
||||||
## SYNOPSIS
|
|
||||||
|
|
||||||
**pypodman** [*global options*] _command_ [*options*]
|
|
||||||
|
|
||||||
## DESCRIPTION
|
|
||||||
|
|
||||||
pypodman is a simple client only tool to help with debugging issues when daemons
|
|
||||||
such as CRI runtime and the kubelet are not responding or failing. pypodman uses
|
|
||||||
a VarLink API to commicate with a podman service running on either the local or
|
|
||||||
remote machine. pypodman uses ssh to create secure tunnels when communicating
|
|
||||||
with a remote service.
|
|
||||||
|
|
||||||
## GLOBAL OPTIONS
|
|
||||||
|
|
||||||
**--help, -h**
|
|
||||||
|
|
||||||
Print usage statement.
|
|
||||||
|
|
||||||
**--version**
|
|
||||||
|
|
||||||
Print program version number and exit.
|
|
||||||
|
|
||||||
**--config-home**
|
|
||||||
|
|
||||||
Directory that will be namespaced with `pypodman` to hold `pypodman.conf`. See FILES below for more details.
|
|
||||||
|
|
||||||
**--log-level**
|
|
||||||
|
|
||||||
Log events above specified level: DEBUG, INFO, WARNING (default), ERROR, or CRITICAL.
|
|
||||||
|
|
||||||
**--run-dir**
|
|
||||||
|
|
||||||
Directory that will be namespaced with `pypodman` to hold local socket bindings. The default is ``$XDG_RUNTIME_DIR\`.
|
|
||||||
|
|
||||||
**--user**
|
|
||||||
|
|
||||||
Authenicating user on remote host. `pypodman` defaults to the logged in user.
|
|
||||||
|
|
||||||
**--host**
|
|
||||||
|
|
||||||
Name of remote host. There is no default, if not given `pypodman` attempts to connect to `--remote-socket-path` on local host.
|
|
||||||
|
|
||||||
**--remote-socket-path**
|
|
||||||
|
|
||||||
Path on remote host for podman service's `AF_UNIX` socket. The default is `/run/podman/io.projectatomic.podman`.
|
|
||||||
|
|
||||||
**--identity-file**
|
|
||||||
|
|
||||||
The optional `ssh` identity file to authenicate when tunnelling to remote host. Default is None and will allow `ssh` to follow it's default methods for resolving the identity and private key using the logged in user.
|
|
||||||
|
|
||||||
## COMMANDS
|
|
||||||
|
|
||||||
See [podman(1)](podman.1.md)
|
|
||||||
|
|
||||||
## FILES
|
|
||||||
|
|
||||||
**pypodman/pypodman.conf** (`Any element of XDG_CONFIG_DIRS` and/or `XDG_CONFIG_HOME` and/or **--config-home**)
|
|
||||||
|
|
||||||
pypodman.conf is one or more configuration files for running the pypodman command. pypodman.conf is a TOML file with the stanza `[default]`, with a map of option: value.
|
|
||||||
|
|
||||||
pypodman follows the XDG (freedesktop.org) conventions for resolving it's configuration. The list below are read from top to bottom with later items overwriting earlier. Any missing items are ignored.
|
|
||||||
|
|
||||||
- `pypodman/pypodman.conf` from any path element in `XDG_CONFIG_DIRS` or `\etc\xdg`
|
|
||||||
- `XDG_CONFIG_HOME` or $HOME/.config + `pypodman/pypodman.conf`
|
|
||||||
- From `--config-home` command line option + `pypodman/pypodman.conf`
|
|
||||||
- From environment variable, for example: RUN_DIR
|
|
||||||
- From command line option, for example: --run-dir
|
|
||||||
|
|
||||||
This should provide Operators the ability to setup basic configurations and allow users to customize them.
|
|
||||||
|
|
||||||
**XDG_RUNTIME_DIR** (`XDG_RUNTIME_DIR/io.projectatomic.podman`)
|
|
||||||
|
|
||||||
Directory where pypodman stores non-essential runtime files and other file objects (such as sockets, named pipes, ...).
|
|
||||||
|
|
||||||
## SEE ALSO
|
|
||||||
`podman(1)`, `libpod(8)`
|
|
0
contrib/python/pypodman/pypodman/__init__.py
Normal file
0
contrib/python/pypodman/pypodman/__init__.py
Normal file
@ -1,3 +1,4 @@
|
|||||||
|
"""Parse configuration while building subcommands."""
|
||||||
import argparse
|
import argparse
|
||||||
import curses
|
import curses
|
||||||
import getpass
|
import getpass
|
||||||
@ -7,7 +8,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
import pytoml
|
import pytoml
|
||||||
|
|
||||||
# TODO: setup.py and obtain __version__ from rpm.spec
|
# TODO: setup.py and obtain __version__ from rpm.spec
|
||||||
@ -38,7 +38,6 @@ class PodmanArgumentParser(argparse.ArgumentParser):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Construct the parser."""
|
"""Construct the parser."""
|
||||||
kwargs['add_help'] = True
|
kwargs['add_help'] = True
|
||||||
kwargs['allow_abbrev'] = True
|
|
||||||
kwargs['description'] = __doc__
|
kwargs['description'] = __doc__
|
||||||
kwargs['formatter_class'] = HelpFormatter
|
kwargs['formatter_class'] = HelpFormatter
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ class PodmanArgumentParser(argparse.ArgumentParser):
|
|||||||
|
|
||||||
# pull in plugin(s) code for each subcommand
|
# pull in plugin(s) code for each subcommand
|
||||||
for name, obj in inspect.getmembers(
|
for name, obj in inspect.getmembers(
|
||||||
sys.modules['lib.actions'],
|
sys.modules['pypodman.lib.actions'],
|
||||||
lambda member: inspect.isclass(member)):
|
lambda member: inspect.isclass(member)):
|
||||||
if hasattr(obj, 'subparser'):
|
if hasattr(obj, 'subparser'):
|
||||||
try:
|
try:
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import _collections_abc
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from contextlib import AbstractContextManager
|
from contextlib import AbstractContextManager
|
||||||
|
assert AbstractContextManager
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Copied from python3.7 library as "backport"
|
|
||||||
class AbstractContextManager(abc.ABC):
|
class AbstractContextManager(abc.ABC):
|
||||||
"""An abstract base class for context managers."""
|
"""An abstract base class for context managers."""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""Return `self` upon entering the runtime context."""
|
"""Return `self` upon entering the runtime context."""
|
||||||
return self
|
return self
|
||||||
@ -19,11 +18,3 @@ except ImportError:
|
|||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
"""Raise any exception triggered within the runtime context."""
|
"""Raise any exception triggered within the runtime context."""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __subclasshook__(cls, C):
|
|
||||||
"""Check whether subclass is considered a subclass of this ABC."""
|
|
||||||
if cls is AbstractContextManager:
|
|
||||||
return _collections_abc._check_methods(C, "__enter__",
|
|
||||||
"__exit__")
|
|
||||||
return NotImplemented
|
|
@ -1,14 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Remote podman client."""
|
"""Remote podman client."""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import lib.actions
|
from .lib import PodmanArgumentParser
|
||||||
from lib import PodmanArgumentParser
|
|
||||||
|
|
||||||
assert lib.actions # silence pyflakes
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
@ -1,4 +1,4 @@
|
|||||||
humanize
|
humanize
|
||||||
podman
|
podman
|
||||||
pytoml
|
pytoml
|
||||||
setuptools>=39.2.0
|
setuptools>=39
|
||||||
|
@ -10,6 +10,7 @@ with open(os.path.join(root, 'README.md')) as me:
|
|||||||
with open(os.path.join(root, 'requirements.txt')) as r:
|
with open(os.path.join(root, 'requirements.txt')) as r:
|
||||||
requirements = r.read().splitlines()
|
requirements = r.read().splitlines()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pypodman',
|
name='pypodman',
|
||||||
version=os.environ.get('PODMAN_VERSION', '0.0.0'),
|
version=os.environ.get('PODMAN_VERSION', '0.0.0'),
|
||||||
@ -19,15 +20,15 @@ setup(
|
|||||||
license='Apache Software License',
|
license='Apache Software License',
|
||||||
long_description=readme,
|
long_description=readme,
|
||||||
entry_points={'console_scripts': [
|
entry_points={'console_scripts': [
|
||||||
'pypodman = lib.pypodman:main',
|
'pypodman = pypodman.main:main',
|
||||||
]},
|
]},
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
keywords='varlink libpod podman pypodman',
|
|
||||||
packages=find_packages(exclude=['test']),
|
packages=find_packages(exclude=['test']),
|
||||||
python_requires='>=3',
|
python_requires='>=3',
|
||||||
zip_safe=True,
|
zip_safe=True,
|
||||||
url='http://github.com/projectatomic/libpod',
|
url='http://github.com/projectatomic/libpod',
|
||||||
|
keywords='varlink libpod podman pypodman',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 3 - Alpha',
|
'Development Status :: 3 - Alpha',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
@ -36,7 +37,7 @@ setup(
|
|||||||
'Operating System :: MacOS :: MacOS X',
|
'Operating System :: MacOS :: MacOS X',
|
||||||
'Operating System :: Microsoft :: Windows',
|
'Operating System :: Microsoft :: Windows',
|
||||||
'Operating System :: POSIX',
|
'Operating System :: POSIX',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3.4',
|
||||||
'Topic :: System :: Systems Administration',
|
'Topic :: System :: Systems Administration',
|
||||||
'Topic :: Utilities',
|
'Topic :: Utilities',
|
||||||
])
|
])
|
||||||
|
@ -205,26 +205,10 @@ Requires: python3-varlink
|
|||||||
Requires: python3-dateutil
|
Requires: python3-dateutil
|
||||||
|
|
||||||
Provides: python3-%{name} = %{version}-%{release}
|
Provides: python3-%{name} = %{version}-%{release}
|
||||||
Summary: Python 3 bindings for %{name}
|
Summary: Python 3 bindings and client for %{name}
|
||||||
|
|
||||||
%description -n python3-%{name}
|
%description -n python3-%{name}
|
||||||
This package contains Python 3 bindings for %{name}.
|
This package contains Python 3 bindings and client for %{name}.
|
||||||
|
|
||||||
%package -n python3-py%{name}
|
|
||||||
BuildArch: noarch
|
|
||||||
BuildRequires: python3-devel
|
|
||||||
BuildRequires: python3-setuptools
|
|
||||||
BuildRequires: python3-varlink
|
|
||||||
|
|
||||||
Requires: python3-setuptools
|
|
||||||
Requires: python3-varlink
|
|
||||||
Requires: python3-dateutil
|
|
||||||
|
|
||||||
Provides: python3-py%{name} = %{version}-%{release}
|
|
||||||
Summary: Python 3 tool for %{name}
|
|
||||||
|
|
||||||
%description -n python3-py%{name}
|
|
||||||
This package contains Python 3 tool for %{name}.
|
|
||||||
%endif # varlink
|
%endif # varlink
|
||||||
|
|
||||||
%if 0%{?with_devel}
|
%if 0%{?with_devel}
|
||||||
@ -403,18 +387,6 @@ GOPATH=$GOPATH go generate ./cmd/podman/varlink/...
|
|||||||
GOPATH=$GOPATH BUILDTAGS=$BUILDTAGS %gobuild -o bin/%{name} %{import_path}/cmd/%{name}
|
GOPATH=$GOPATH BUILDTAGS=$BUILDTAGS %gobuild -o bin/%{name} %{import_path}/cmd/%{name}
|
||||||
BUILDTAGS=$BUILDTAGS make binaries docs
|
BUILDTAGS=$BUILDTAGS make binaries docs
|
||||||
|
|
||||||
%if %{with varlink}
|
|
||||||
#untar contents for python-podman
|
|
||||||
pushd contrib/python/podman/dist
|
|
||||||
tar zxf %{name}*.tar.gz
|
|
||||||
popd
|
|
||||||
|
|
||||||
#untar contents for python-pypodman
|
|
||||||
pushd contrib/python/pypodman/dist
|
|
||||||
tar zxf %{name}*.tar.gz
|
|
||||||
popd
|
|
||||||
%endif #varlink
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -dp %{buildroot}%{_unitdir}
|
install -dp %{buildroot}%{_unitdir}
|
||||||
%make_install PREFIX=%{buildroot}%{_prefix} install install.completions
|
%make_install PREFIX=%{buildroot}%{_prefix} install install.completions
|
||||||
@ -502,6 +474,7 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README.md CONTRIBUTING.md install.md code-of-conduct.md transfer.md
|
%doc README.md CONTRIBUTING.md install.md code-of-conduct.md transfer.md
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
|
%{_bindir}/py%{name}
|
||||||
%{_mandir}/man1/*.1*
|
%{_mandir}/man1/*.1*
|
||||||
%{_mandir}/man5/*.5*
|
%{_mandir}/man5/*.5*
|
||||||
%{_datadir}/bash-completion/completions/*
|
%{_datadir}/bash-completion/completions/*
|
||||||
|
104
contrib/spec/python-podman.spec.in
Normal file
104
contrib/spec/python-podman.spec.in
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
# If any of the following macros should be set otherwise,
|
||||||
|
# you can wrap any of them with the following conditions:
|
||||||
|
# - %%if 0%%{?centos} == 7
|
||||||
|
# - %%if 0%%{?rhel} == 7
|
||||||
|
# - %%if 0%%{?fedora} == 23
|
||||||
|
# Or just test for particular distribution:
|
||||||
|
# - %%if 0%%{?centos}
|
||||||
|
# - %%if 0%%{?rhel}
|
||||||
|
# - %%if 0%%{?fedora}
|
||||||
|
#
|
||||||
|
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
|
||||||
|
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
|
||||||
|
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
|
||||||
|
|
||||||
|
%undefine _enable_debug_packages
|
||||||
|
|
||||||
|
%global provider github
|
||||||
|
%global provider_tld com
|
||||||
|
%global project projectatomic
|
||||||
|
%global repo libpod
|
||||||
|
# https://github.com/projectatomic/libpod
|
||||||
|
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
||||||
|
%global import_path %{provider_prefix}
|
||||||
|
%global commit #COMMIT#
|
||||||
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||||
|
|
||||||
|
Name: python3-podman
|
||||||
|
Version: 0.7.3
|
||||||
|
Release: #COMMITDATE#.git%{shortcommit}%{?dist}
|
||||||
|
Summary: Python 3 bindings and client for podman
|
||||||
|
License: ASL 2.0
|
||||||
|
URL: https://%{provider_prefix}
|
||||||
|
Source0: https://api.%{provider}.%{provider_tld}/repos/%{project}/%{repo}/tarball/%{commit}
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: git
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-setuptools
|
||||||
|
BuildRequires: python3-varlink
|
||||||
|
|
||||||
|
Requires: python3-humanize
|
||||||
|
Requires: python3-pytoml
|
||||||
|
Requires: python3-setuptools
|
||||||
|
Requires: python3-varlink
|
||||||
|
Requires: podman
|
||||||
|
|
||||||
|
%if 0%{?fedora}
|
||||||
|
# 2018-07-20 RHEL8 doesn't have varlink RPM yet
|
||||||
|
Requires: python3-varlink
|
||||||
|
%endif
|
||||||
|
|
||||||
|
Provides: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}
|
||||||
|
python3-podman provides python bindings and client for communicating
|
||||||
|
with podman as a service.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -Sgit -n %{project}-%{repo}-%{shortcommit}
|
||||||
|
|
||||||
|
%build
|
||||||
|
export PODMAN_VERSION=%{version}
|
||||||
|
|
||||||
|
pushd contrib/python/podman
|
||||||
|
%{__python3} setup.py build
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd contrib/python/pypodman
|
||||||
|
%{__python3} setup.py build
|
||||||
|
popd
|
||||||
|
|
||||||
|
%install
|
||||||
|
export PODMAN_VERSION=%{version}
|
||||||
|
|
||||||
|
install -d -m 755 %{buildroot}%{_mandir}/man1
|
||||||
|
|
||||||
|
pushd contrib/python/pypodman
|
||||||
|
install -m 644 -t %{buildroot}%{_mandir}/man1 docs/man1/*.1
|
||||||
|
%{__python3} setup.py install --skip-build --root %{buildroot}
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd contrib/python/podman
|
||||||
|
%{__python3} setup.py install --skip-build --root %{buildroot}
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
%check
|
||||||
|
#define license tag if not already defined
|
||||||
|
%{!?_licensedir:%global license %doc}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE
|
||||||
|
%doc README.md CONTRIBUTING.md install.md code-of-conduct.md transfer.md
|
||||||
|
%{_bindir}/pypodman
|
||||||
|
%{_mandir}/man1/pypodman.1*
|
||||||
|
%dir %{python3_sitelib}/podman
|
||||||
|
%dir %{python3_sitelib}/pypodman
|
||||||
|
%{python3_sitelib}/podman/*
|
||||||
|
%{python3_sitelib}/pypodman/*
|
||||||
|
%{python3_sitelib}/podman-%{version}*.egg-info
|
||||||
|
%{python3_sitelib}/pypodman-%{version}*.egg-info
|
||||||
|
|
||||||
|
%changelog
|
Reference in New Issue
Block a user