-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 262d386
Showing
24 changed files
with
636 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
tags: | ||
- v* | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, macos-11] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/pyrpmdb | ||
permissions: | ||
id-token: write | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
# unpacks default artifact into dist/ | ||
# if `name: artifact` is omitted, the action will create extra parent dir | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
# To test: repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true | ||
verbose: true | ||
verify-metadata: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
This package uses [setuptools-golang](https://pypi.org/project/setuptools-golang-examples/) for installation and to build manylinux wheels. | ||
The code is modified [this line](https://github.com/asottile/setuptools-golang/blob/main/setuptools_golang.py#L234) needs adjusting we replace docker image with a more modern version to get support for 3.10 and 3.11. | ||
|
||
Currently using quay.io/pypa/manylinux_2_24_x86_64:latest as latest image this gets us 3.6 - 3.11 on linu | ||
|
||
|
||
Build is currently | ||
```shell | ||
setuptools-golang-build-manylinux-wheels --golang=1.21.1 --pythons 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311' | ||
cd src/pygobuildinfo | ||
env GOOS="windows" GOARCH="amd64" CGO_ENABLED="1" CC="x86_64-w64-mingw32-gcc" go build -buildmode=c-shared -o pygo.dll | ||
``` | ||
So builds for linux x86 images for python versions 3.6 through to 3.10 | ||
|
||
NB On environments that prebuilt libraries are not supported go >= 1.8 MUST be installed and on the path. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include README.md | ||
include *.go go.mod go.sum | ||
include LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
A python package that extracts go build information from go based executables, go.mod and go.sum files and shared libraries. The package leverages the golang debug/buildinfo and golang.org/x/mod/modfile packages to extract the information hence relies on a shared library to do this work. | ||
|
||
Example usage | ||
|
||
```python | ||
|
||
from pyrpmdb import get_rpm_db_info | ||
import json | ||
|
||
|
||
def test_get_info(file): | ||
res = get_rpm_db_info(file) | ||
print(json.dumps(res, indent=4)) | ||
|
||
|
||
test_get_info("foo/bar") | ||
test_get_info("/usr/bin/du") | ||
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider.elf") | ||
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider.exe") | ||
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider") | ||
test_get_info("/Users/auser/go/pygobuildinfo/pybuildInfo/_pyGoBuildinfo.cpython-39-darwin.so") | ||
test_go_mod("/Users/auser/go/src/pygobuildInfo/go.mod") | ||
test_go_sum("/Users/auser/go/src/pygobuildInfo/go.sum") | ||
``` | ||
|
||
The result returned is always a dict object for errors the dictionary returned contains a key; | ||
"error" like; | ||
```python | ||
{ | ||
"error": "path error:foo/bar" | ||
} | ||
``` | ||
or | ||
```python | ||
{ | ||
"error": "/usr/bin/du: could not read Go build info from /usr/bin/du: unrecognized file format" | ||
} | ||
``` | ||
on success a python list of rpm package info struct is returned of this go structure serialized | ||
|
||
```go | ||
type PackageInfo struct { | ||
Epoch *int | ||
Name string | ||
Version string | ||
Release string | ||
Arch string | ||
SourceRpm string | ||
Size int | ||
License string | ||
Vendor string | ||
Modularitylabel string | ||
Summary string | ||
PGP string | ||
SigMD5 string | ||
DigestAlgorithm DigestAlgorithm | ||
InstallTime int | ||
BaseNames []string | ||
DirIndexes []int32 | ||
DirNames []string | ||
FileSizes []int32 | ||
FileDigests []string | ||
FileModes []uint16 | ||
FileFlags []int32 | ||
UserNames []string | ||
GroupNames []string | ||
|
||
Provides []string | ||
Requires []string | ||
} | ||
``` | ||
```python | ||
[ | ||
{ | ||
"Name": "package_name", | ||
"Version": "version" | ||
} | ||
] | ||
``` | ||
This spackage relies on a shared go library that leverages https://pkg.go.dev/github.com/knqyf263/go-rpmdb/pkg | ||
|
||
So relies on this for database support. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from pyrpmdb import get_rpm_db_info | ||
import glob | ||
import sys | ||
import json | ||
|
||
for arg in sys.argv[1:]: | ||
for file in glob.glob(arg): | ||
result = get_rpm_db_info(file) | ||
print(json.dumps(result,indent=4)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module pyrpmdb | ||
|
||
go 1.21 | ||
|
||
require github.com/knqyf263/go-rpmdb v0.0.0-20201215100354-a9e3110d8ee1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/go-restruct/restruct v0.0.0-20191227155143-5734170a48a1/go.mod h1:KqrpKpn4M8OLznErihXTGLlsXFGeLxHUrLRRI/1YjGk= | ||
github.com/knqyf263/go-rpmdb v0.0.0-20201215100354-a9e3110d8ee1/go.mod h1:RDPNeIkU5NWXtt0OMEoILyxwUC/DyXeRtK295wpqSi0= | ||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | ||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= | ||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
Oops, something went wrong.