Files
pymod2pkg/doc/source/index.rst
Javier Pena 58a12b93a3 Add mapping for OpenStack project names
This patch adds a new OPENSTACK_UPSTREAM_PKG_MAP map to map PyPi
names to OpenStack project names, as they are not always the same,
and a --upstream command-line argument to pymod2pkg.

Change-Id: I4eda55b4d7b2dcc8df28912913b876e2c40289b3
2016-09-07 15:49:52 +02:00

1.8 KiB

pymod2pkg

pymod2pkg is a simple python module for translating python module names to corresponding package names which is a common problem in the packaging world.

Note

Note that rdopkg uses this module to check whether packages corresponding to requirements.txt are available across distros and more.

Installation

From source

If you want to hack pymod2pkg or just have the latest version without waiting for next release, I suggest using the git repo directly a la

git clone https://git.openstack.org/openstack/pymod2pkg
cd pymod2pkg
python setup.py develop --user

From PyPI

For your convenience, pymod2pkg is also available from the Cheese Shop:

pip install pymod2pkg

Usage

module2package is probably all you need, it accepts a module name to convert and a linux distribution name as returned by `platform.linux_distribution()[0]`:

import pymod2pkg
pkg = pymod2pkg.module2package('six', 'Fedora')

An upstream map is also provided, to translate python module names to OpenStack project names.

There's not much more, really, so RTFS.

Fixing/extending the map

Currently, only package maps for RPM-based systems and upstream OpenStack are provided, but it'd be nice to have all the distros covered and it's really easy to do.

See *_PKG_MAP and get_pkg_map, hack it to your liking and submit review by

git review

Running the testsuite

Run tests by:

python tests.py

Indices and tables

  • genindex
  • search