Welcome to pkgsetcomp’s documentation!¶
Contents:
pkgsetcomp¶
GitHub | PyPi | Warehouse | ReadTheDocs | Travis-CI



pkgsetcomp: compare and generate manifest / installed package reports
Features¶
- Compare packages listed in a debian/ubuntu APT manifest file with currently installed packages
- optparse argument parsing (-h, --help)
- cookiecutter-pypackage project templating
Installing¶
Install from PyPi:
pip install pkgsetcomp
Install from GitHub as editable (add a pkgsetcomp.pth in site-packages):
pip install -e git+https://github.com/westurner/pkgsetcomp#egg=pkgsetcomp
Usage¶
Print help:
pkgsetcomp --help
Generate reports in the current directory:
pkgsetcomp
Generate a report comparing .manifest packages with installed packages:
MANIFEST="http://releases.ubuntu.com/14.04/ubuntu-14.04-desktop-amd64.manifest"
pkgsetcomp --manifest="$MANIFEST"
License¶
Installation¶
At the command line:
$ easy_install pkgsetcomp
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv pkgsetcomp
$ pip install pkgsetcomp
pkgsetcomp package¶
Submodules¶
pkgsetcomp.pkgsetcomp module¶
- class pkgsetcomp.pkgsetcomp.PkgComparison[source]¶
Bases: pkgsetcomp.pkgsetcomp.PkgComparison
A package set comparison namedtuple with serializers
- pkgsetcomp.pkgsetcomp.compare_package_lists(manifest, installed)[source]¶
Compare two sets (manifest, installed) of package names.
Parameters: - default (iterable) – names of packages listed in a given MANIFEST
- installed (iterable) – names of packages installed locally
Returns: set comparison outputs
Return type: PkgComparison
- pkgsetcomp.pkgsetcomp.ensure_file(command, filename, overwrite=False, shell=False)[source]¶
Run a command if a file doesn’t exist
Parameters: - command (str) – shell command to subprocess.call
- filename (str) – path to os.path.exists
- overwrite (bool) – if true, overwrite existing file
- shell (bool) – subprocess command parsing
Returns: None
- pkgsetcomp.pkgsetcomp.get_installed_packages(cache=False, output_dir='.', output_filename='installed.pkgs.txt')[source]¶
Get a list of the packages in a manifest
Parameters: manifest_url (str) – path or URL of a debian/ubuntu .manifest file Returns:
- pkgsetcomp.pkgsetcomp.get_manifest_packages(cache=False, manifest_url=None, output_dir='.', output_filename='manifest.pkgs.txt')[source]¶
Get a list of the packages in a manifest
Parameters: manifest_url (str) – path or URL of a debian/ubuntu .manifest file Returns:
- pkgsetcomp.pkgsetcomp.get_package_lists(manifest_url='/var/build/user_builds/pkgsetcomp/checkouts/latest/pkgsetcomp/../tests/testdata/ubuntu-12.04.4-desktop-i386.manifest', cache=False, output_dir=None)[source]¶
Get list of installed packages and manifest packages
- Generate:
- installed.pkgs.txt manifest.pkgs.txt
Parameters: cache (bool) – whether to cache Returns: tuple of lists: (installed, manifest) Note
adapted from: http://unix.stackexchange.com/a/3624
- pkgsetcomp.pkgsetcomp.pkgsetcomp_packages_with_manifest(manifest_url, output_dir)[source]¶
Compare installed packages with manifest packages
Parameters: - manifest_url (str) – URL (or local path) to a debian/ubuntu .manifest
- output_dir (str) – directory in which to write .pkg.sh and pkg.txt files
Returns: output of compare_package_lists
Return type: PkgComparison
pkgsetcomp.pyrpo module¶
Module contents¶
pkgsetcomp module
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/westurner/pkgsetcomp/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
pkgsetcomp could always use more documentation, whether as part of the official pkgsetcomp docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/westurner/pkgsetcomp/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up pkgsetcomp for local development.
Fork the pkgsetcomp repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/pkgsetcomp.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv pkgsetcomp $ cd pkgsetcomp/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 pkgsetcomp tests $ python setup.py test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travis-ci.org/westurner/pkgsetcomp/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
- Wes Turner – https://github.com/westurner
History¶
0.1.4 (Unreleased)¶
0.1.3 (2014-05-21)¶
- BLD,TST,ENH,DOC: add py.test passthrough options to ‘setup.py test’
- DOC: add pykg setcomp api docs to index
- DOC: docs/license.rst include LICENSE
- DOC: README.rst :: directive
0.1.2 (2014-05-21)¶
- BUG: VERSION.txt os.path.basename
- DOC: API docs: docs/modules.rst docs/pkgsetcomp.rst
- DOC: Release summaries in HISTORY.txt
0.1.1 (2014-05-21)¶
- ENH: Read version number from VERSION.txt
0.1.0 (2014-05-21)¶
- First release on PyPI.
- Re-packaged from https://github.com/westurner/dotfiles/blob/2813e4ad/scripts/compare_installed.py
License¶
Copyright (c) 2014, Wes Turner All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of pkgsetcomp nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.