{ "info": { "author": "Benjamin Kircher", "author_email": "benjamin.kircher@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# python-rpm-spec\n\n[![Build Status](https://travis-ci.org/bkircher/python-rpm-spec.svg?branch=master)](https://travis-ci.org/bkircher/python-rpm-spec)\n\npython-rpm-spec is a Python library for parsing RPM spec files.\n\ntl;dr\nIf you want to quickly parse a spec file on the command line you might want to\ngive `rpmspec --parse` a try.\n```sh\n$ rpmspec --parse file.spec | awk '/Source/ {print $2}'\n```\n\nIf you write Python, have no `/usr/bin/rpm` around, or want to do something\nslightly more complicated, try using this Python module.\n\nRPMs are build from a package's sources along with a spec file. The spec file\ncontrols how the RPM is built. This module allows you to parse spec files and\ngives you simple access to various bits of information that is contained in the\nspec file.\n\n## Features\n* No extra dependencies other than Python 3\n* Available on all platforms, parse spec files on Windows\n\n## Examples\nThis is how you access a spec file's various definitions:\n```python\nfrom pyrpm.spec import Spec, replace_macros\n\nspec = Spec.from_file('llvm.spec')\nprint(spec.version) # 3.8.0\nprint(spec.sources[0]) # http://llvm.org/releases/%{version}/%{name}-%{version}.src.tar.xz\nprint(replace_macros(spec.sources[0], spec)) # http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz\n\nfor package in spec.packages:\n print(f'{package.name}: {package.summary if hasattr(package, \"summary\") else spec.summary}')\n\n # llvm: The Low Level Virtual Machine\n # llvm-devel: Libraries and header files for LLVM\n # llvm-doc: Documentation for LLVM\n # llvm-libs: LLVM shared libraries\n # llvm-static: LLVM static libraries\n\n```\n\nExample showing how to retrieve named source or patch files from a spec:\n```python\nfrom pyrpm.spec import Spec\n\nspec = Spec.from_file('llvm.spec')\n\n# Access sources and patches via name\nfor k, v in spec.sources_dict.items():\n print(f'{k} \u2192 {v}')\n\n# Source0 \u2192 http://llvm.org/releases/%{version}/%{name}-%{version}.src.tar.xz\n# Source100 \u2192 llvm-config.h\n\n# Or as a list with indices and so on\nfor source in spec.sources:\n print(source)\n\n# http://llvm.org/releases/%{version}/%{name}-%{version}.src.tar.xz\n# llvm-config.h\n```\n\nExample showing how to get versioned `BuildRequires:` and `Requires:` out of a\nspec file:\n```python\nfrom pyrpm.spec import Spec\n\nspec = Spec.from_file('attica-qt5.spec')\n\n# Access sources and patches via name\nfor br in spec.build_requires:\n print(f'{br.name} {br.operator} {br.version}' if br.version else f'{br.name}')\n\n# cmake >= 3.0\n# extra-cmake-modules >= %{_tar_path}\n# fdupes\n# kf5-filesystem\n# pkg-config\n# cmake(Qt5Core) >= 5.6.0\n# cmake(Qt5Network) >= 5.6.0\n```\n\n## Install\n\npython-rpm-spec is hosted on PyPI - the Python Package Index. So all you need to do is\n\n```bash\n$ pip install python-rpm-spec\n```\n\nin your virtual environment.\n\nAlternatively, if you run Fedora, you can enable a copr repository and use the\npackage manager to install a python-rpm-spec as a normal package in your\nsystem.\n\n```bash\n$ sudo dnf copr enable bkircher/python-rpm-spec # Enable copr repo\n$ sudo dnf install -y python3-rpm-spec # Install the package\n```\n\n## Dependencies\nExcept Python 3 no extra dependencies are required. No Python 2, sorry.\n\n## Current status\nThis module does not parse everything of a spec file. Only the pieces I needed.\nSo there is probably still plenty of stuff missing. However, it should not be\nterribly complicated to add support for the missing pieces.\n\n## Development\nIf you want to hack on this module you could start with following recipe:\n\n```bash\n$ git clone https://github.com/bkircher/python-rpm-spec.git # Clone the repo\n$ cd python-rpm-spec # Change into the source directory\n$ mkdir .venv && python3 -m venv .venv # Create a virtual environment\n$ source .venv/bin/activate # Activate it\n$ pip install pytest # Install py.test\n$ pytest # Execute all tests\n```\nHappy hacking!\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bkircher/python-rpm-spec", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "python-rpm-spec", "package_url": "https://pypi.org/project/python-rpm-spec/", "platform": "", "project_url": "https://pypi.org/project/python-rpm-spec/", "project_urls": { "Homepage": "https://github.com/bkircher/python-rpm-spec" }, "release_url": "https://pypi.org/project/python-rpm-spec/0.8/", "requires_dist": null, "requires_python": ">=3.3", "summary": "python-rpm-spec is a Python library for parsing RPM spec files.", "version": "0.8" }, "last_serial": 4285734, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a9bc36a2e8385ea5068c58d44bfe427e", "sha256": "12bdc044db0e87b6115fe59f577ad28aa25e0b373940d7a046dc1d585e224298" }, "downloads": -1, "filename": "python-rpm-spec-0.1.tar.gz", "has_sig": false, "md5_digest": "a9bc36a2e8385ea5068c58d44bfe427e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1891, "upload_time": "2017-01-04T07:32:15", "url": "https://files.pythonhosted.org/packages/5f/6e/16bc4d30c884077ca6b4680ab8ebb3f3c7b4eae4a2540206719765a51111/python-rpm-spec-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "0f1ab553b02d06cdd7e17c9210cd2ba4", "sha256": "00ce46ae3abda823c9e5193148bf5328498daca74ddf93807a83f019b57da72a" }, "downloads": -1, "filename": "python-rpm-spec-0.2.zip", "has_sig": false, "md5_digest": "0f1ab553b02d06cdd7e17c9210cd2ba4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3426, "upload_time": "2017-01-23T15:11:32", "url": "https://files.pythonhosted.org/packages/fc/d5/a26f1c16af2f4e3009bb38326b5e6a6c22dc17cdd7247d0c20f5c520bd26/python-rpm-spec-0.2.zip" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "f1ef79f76cfcb829cf4ba7ed2d414a7a", "sha256": "0944c97e9976027b630b0feff419ff1542f5443bb5b5e132e1c188c46f039d72" }, "downloads": -1, "filename": "python-rpm-spec-0.3.tar.gz", "has_sig": false, "md5_digest": "f1ef79f76cfcb829cf4ba7ed2d414a7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2916, "upload_time": "2017-01-27T13:22:49", "url": "https://files.pythonhosted.org/packages/a9/7c/91961fbaf740943a31377fd57d74cdb23556d139ff09825ac0b1f0273797/python-rpm-spec-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "a71cb555ed8d5c750cdd3b8b2e716034", "sha256": "36d6d1b3b30b4e2664a6c54bb0a52fe3b25eddfa281de40dfe98de0b80e9758b" }, "downloads": -1, "filename": "python-rpm-spec-0.4.tar.gz", "has_sig": false, "md5_digest": "a71cb555ed8d5c750cdd3b8b2e716034", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2918, "upload_time": "2017-02-09T17:51:03", "url": "https://files.pythonhosted.org/packages/b5/04/ea4e52e866c2846d0be17028e6c14732c97e11fd5c4734f2461ada454c01/python-rpm-spec-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "efffaffb6bdb2b0f8240a34b3c1ff489", "sha256": "cd19ba6ac65810d551bf4c37859723660387247ef0c9920a07a81578eaea2f98" }, "downloads": -1, "filename": "python-rpm-spec-0.5.tar.gz", "has_sig": false, "md5_digest": "efffaffb6bdb2b0f8240a34b3c1ff489", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2978, "upload_time": "2017-03-25T08:20:34", "url": "https://files.pythonhosted.org/packages/2f/10/2117aba3cca8ae9e0b54412aa10a3fd284930820316abe9b797450039a11/python-rpm-spec-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "064c43000a4f759c834a80e3f37c4c38", "sha256": "1288c458cec9c7530124c3e42877024a7718696310ecb85bfb1ab3829a8024c3" }, "downloads": -1, "filename": "python-rpm-spec-0.6.tar.gz", "has_sig": false, "md5_digest": "064c43000a4f759c834a80e3f37c4c38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2971, "upload_time": "2017-07-27T16:12:09", "url": "https://files.pythonhosted.org/packages/87/e7/5036854182ef9a431cd2c1bf974faaff92dbbf08daf786b085b501de195b/python-rpm-spec-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "a05c09e2a5a7445b17ab4fc566d46d33", "sha256": "73397c3351a7392ef05b274f7003eb78f487ad350d0c7ee317ef5361037ad27d" }, "downloads": -1, "filename": "python-rpm-spec-0.7.tar.gz", "has_sig": false, "md5_digest": "a05c09e2a5a7445b17ab4fc566d46d33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3433, "upload_time": "2017-08-10T18:38:13", "url": "https://files.pythonhosted.org/packages/6f/06/56493906fb8dc655860e07c6fcbb06fcffec733a7a949278753dab3983ed/python-rpm-spec-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "06b56959226b4251864ff7e28577b644", "sha256": "8c43b2b514204f30c91c44f3d667f73ca22a51c4f16b69f13a0fd1d9087ebf82" }, "downloads": -1, "filename": "python_rpm_spec-0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "06b56959226b4251864ff7e28577b644", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3", "size": 18058, "upload_time": "2018-09-18T20:03:35", "url": "https://files.pythonhosted.org/packages/c5/59/fcea444d3240df6cdb4c48d5d2bb3f6c6e4723b4d0d420381e0a94f062ae/python_rpm_spec-0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cfd6f5671109a2cd9a1210f8f81b99ab", "sha256": "9eca9aa22a0301f3065d6028efb88503bbd343789bb1d3143cf569db1524f696" }, "downloads": -1, "filename": "python-rpm-spec-0.8.tar.gz", "has_sig": false, "md5_digest": "cfd6f5671109a2cd9a1210f8f81b99ab", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3", "size": 40634, "upload_time": "2018-09-18T20:03:47", "url": "https://files.pythonhosted.org/packages/27/30/f9f0c727b65d48e91f205080297a5bef4a814f260fd3edab7198f3767d11/python-rpm-spec-0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "06b56959226b4251864ff7e28577b644", "sha256": "8c43b2b514204f30c91c44f3d667f73ca22a51c4f16b69f13a0fd1d9087ebf82" }, "downloads": -1, "filename": "python_rpm_spec-0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "06b56959226b4251864ff7e28577b644", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3", "size": 18058, "upload_time": "2018-09-18T20:03:35", "url": "https://files.pythonhosted.org/packages/c5/59/fcea444d3240df6cdb4c48d5d2bb3f6c6e4723b4d0d420381e0a94f062ae/python_rpm_spec-0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cfd6f5671109a2cd9a1210f8f81b99ab", "sha256": "9eca9aa22a0301f3065d6028efb88503bbd343789bb1d3143cf569db1524f696" }, "downloads": -1, "filename": "python-rpm-spec-0.8.tar.gz", "has_sig": false, "md5_digest": "cfd6f5671109a2cd9a1210f8f81b99ab", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3", "size": 40634, "upload_time": "2018-09-18T20:03:47", "url": "https://files.pythonhosted.org/packages/27/30/f9f0c727b65d48e91f205080297a5bef4a814f260fd3edab7198f3767d11/python-rpm-spec-0.8.tar.gz" } ] }