75f221f
# Sphinx-generated HTML documentation is not suitable for packaging; see
75f221f
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
75f221f
#
75f221f
# We can generate PDF documentation as a substitute.
75f221f
%bcond_without doc_pdf
75f221f
3150fe4
%global forgeurl https://github.com/uqfoundation/pox
3150fe4
75f221f
Name:           python-pox
df8c468
Version:        0.3.4
75f221f
Release:        %autorelease
75f221f
Summary:        Utilities for filesystem exploration and automated builds
75f221f
df8c468
%global tag     %{version}
3150fe4
%forgemeta
3150fe4
df8c468
# spdx
df8c468
License:        BSD-3-Clause
3150fe4
URL:            %{forgeurl}
3150fe4
Source0:        %{forgesource}
75f221f
75f221f
BuildArch:      noarch
75f221f
75f221f
BuildRequires:  python3-devel
75f221f
BuildRequires:  python3dist(pytest)
75f221f
75f221f
%if %{with doc_pdf}
75f221f
BuildRequires:  make
75f221f
BuildRequires:  python3dist(sphinx)
75f221f
BuildRequires:  python3-sphinx-latex
75f221f
BuildRequires:  latexmk
75f221f
%endif
2d0332b
2d0332b
%global _description %{expand:
2d0332b
pox provides a collection of utilities for navigating and manipulating
2d0332b
filesystems. This module is designed to facilitate some of the low level
2d0332b
operating system interactions that are useful when exploring a filesystem on a
2d0332b
remote host, where queries such as "what is the root of the filesystem?", "what
2d0332b
is the user's name?", and "what login shell is preferred?" become essential in
2d0332b
allowing a remote user to function as if they were logged in locally. While pox
2d0332b
is in the same vein of both the os and shutil builtin modules, the majority of
2d0332b
its functionality is unique and compliments these two modules.
2d0332b
2d0332b
pox provides python equivalents of several unix shell commands such as which
2d0332b
and find. These commands allow automated discovery of what has been installed
2d0332b
on an operating system, and where the essential tools are located. This
2d0332b
capability is useful not only for exploring remote hosts, but also locally as a
2d0332b
helper utility for automated build and installation.
2d0332b
2d0332b
Several high-level operations on files and filesystems are also provided.
2d0332b
Examples of which are: finding the location of an installed python package,
2d0332b
determining if and where the source code resides on the filesystem, and
2d0332b
determining what version the installed package is.
2d0332b
2d0332b
pox also provides utilities to enable the abstraction of commands sent to a
2d0332b
remote filesystem. In conjunction with a registry of environment variables and
df8c468
installed utilities, pox enables the user to interact with a remote filesystem
2d0332b
as if they were logged in locally.
2d0332b
2d0332b
pox is part of pathos, a python framework for heterogeneous computing. pox is
2d0332b
in active development, so any user feedback, bug reports, comments, or
2d0332b
suggestions are highly appreciated. A list of issues is located at
2d0332b
https://github.com/uqfoundation/pox/issues, with a legacy list maintained at
2d0332b
https://uqfoundation.github.io/project/pathos/query.
2d0332b
2d0332b
Major Features
2d0332b
2d0332b
pox provides utilities for discovering the user's environment:
2d0332b
2d0332b
- return the user's name, current shell, and path to user's home directory
2d0332b
- strip duplicate entries from the user's $PATH
2d0332b
- lookup and expand environment variables from ${VAR} to value
2d0332b
2d0332b
pox also provides utilities for filesystem exploration and manipulation:
2d0332b
df8c468
- discover the path to a file, executable, directory, or symbolic link
2d0332b
- discover the path to an installed package
2d0332b
- parse operating system commands for remote shell invocation
2d0332b
- convert text files to platform-specific formatting}
2d0332b
2d0332b
%description %_description
2d0332b
75f221f
%package -n python3-pox
2d0332b
Summary:        %{summary}
2d0332b
75f221f
%description -n python3-pox %_description
2d0332b
2d0332b
%package doc
2d0332b
Summary:        Documentation for %{name}
2d0332b
2d0332b
%description doc
2d0332b
This package provides documentation for %{name}.
2d0332b
2d0332b
%prep
3150fe4
%forgesetup
75f221f
# Remove shebangs from (installed) non-script sources. The find-then-modify
75f221f
# pattern preserves mtimes on sources that did not need to be modified.
75f221f
find 'pox' 'tests' -type f -name '*.py' \
75f221f
    -exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
75f221f
  xargs -r sed -r -i '1{/^#!/d}'
2d0332b
75f221f
%generate_buildrequires
75f221f
%pyproject_buildrequires -t
2d0332b
2d0332b
%build
75f221f
%pyproject_wheel
75f221f
%if %{with doc_pdf}
75f221f
# Makefile contains no “latex” target, so we invoke sphinx-build manually
75f221f
PYTHONPATH="${PWD}" sphinx-build -b latex %{?_smp_mflags} \
75f221f
    docs/source %{_vpath_builddir}/_latex
75f221f
%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'
75f221f
%endif
2d0332b
2d0332b
%install
75f221f
%pyproject_install
550acde
%pyproject_save_files -l pox
2d0332b
df8c468
# remove shebang from generated file
df8c468
sed -r -i '1{/^#!/d}' $RPM_BUILD_ROOT/%{python3_sitelib}/pox/__info__.py
df8c468
2d0332b
%check
75f221f
# There is a check in test_shutils that the user’s home directory ends with the
75f221f
# username, which is by no means always true, and which is not true in the
75f221f
# mock/koji build environment. We work around this by faking the home directory
75f221f
# environment variable with an empty directory.
75f221f
BOGUSHOME="${PWD}/_bogus/$(id --user --name)"
75f221f
mkdir -p "${BOGUSHOME}"
75f221f
HOME="${BOGUSHOME}" %pytest
75f221f
75f221f
%files -n python3-pox -f %{pyproject_files}
5d0a4c8
%doc README.md
75f221f
%{_bindir}/pox
2d0332b
2d0332b
%files doc
2d0332b
%license LICENSE
75f221f
%if %{with doc_pdf}
75f221f
%doc %{_vpath_builddir}/_latex/pox.pdf
75f221f
%endif
2d0332b
2d0332b
%changelog
d7cd348
%autochangelog