Skip to content

Commit

Permalink
Prep v1.6.0 (#132)
Browse files Browse the repository at this point in the history
* updated spec and added Makefile

* gh-pages submodule

* prep docs for 1.6.0

* rel 1

* we won't use the Containerized build stuff, RPMs are not a priority

* correct changelog

* omit the announce action for now

* add a twine check to tox

* fix trigger for tox action
  • Loading branch information
obriencj authored Jul 27, 2023
1 parent 0b1582d commit 0264da3
Show file tree
Hide file tree
Showing 8 changed files with 381 additions and 70 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1


announce:
name: Announce release to @[email protected]
runs-on: ubuntu-latest

needs:
- publish

steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Create announcement post
uses: rzr/fediverse-action@master
with:
host: fosstodon.org
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}

message: |
Version ${{ github.ref }} of python-javatools was released on ${{ steps.date.outputs.date }}
https://github.com/obriencj/python-javatools/releases/tag/${{ github.ref }}
\#python \#javatools
# The end.
10 changes: 6 additions & 4 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ on:
ignore-paths:
- 'docs/**'
paths:
- '*.py'
- '*.tmpl'
- 'setup.*'
- '**/*.py'
- '**/*.tmpl'
- 'tests/**'

pull_request:
ignore-paths:
- 'docs/**'
paths:
- '*.py'
- '*.tmpl'
- 'setup.*'
- '**/*.py'
- '**/*.tmpl'
- 'tests/**'


Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "gh-pages"]
path = gh-pages
url = ./
branch = gh-pages
150 changes: 150 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Sorry that this Makefile is a bit of a disaster.


PYTHON ?= $(shell which python3 python 2>/dev/null | head -n1)
PYTHON := $(PYTHON)


PROJECT := $(shell $(PYTHON) ./setup.py --name)
VERSION := $(shell $(PYTHON) ./setup.py --version)

ARCHIVE := python-$(PROJECT)-$(VERSION).tar.gz


# We use this later in setting up the gh-pages submodule for pushing,
# so forks will push their docs to their own gh-pages branch.
ORIGIN_PUSH = $(shell git remote get-url --push origin)


##@ Basic Targets
default: quick-test ## Runs the quick-test target


help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


report-python:
@echo "Using python" $(PYTHON)
@$(PYTHON) -VV


##@ Local Build and Install
build: clean-built report-python flake8 ## Produces a wheel using the default system python
@$(PYTHON) setup.py bdist_wheel


install: quick-test ## Installs using the default python for the current user
@$(PYTHON) -B -m pip.__main__ \
install --no-deps --user -I \
dist/$(PROJECT)-$(VERSION)-py3-none-any.whl


##@ Cleanup
tidy: ## Removes stray eggs and .pyc files
@rm -rf *.egg-info
@find -H . \
\( -iname '.tox' -o -iname '.eggs' -prune \) -o \
\( -type d -iname '__pycache__' -exec rm -rf {} + \) -o \
\( -type f -iname '*.pyc' -exec rm -f {} + \)


clean-built:
@rm -rf build/* dist/*
@if [ -f ./"$(ARCHIVE)" ] ; then rm -f ./"$(ARCHIVE)" ; fi


clean: clean-built tidy ## Removes built content, test logs, coverage reports
@rm -rf .coverage* htmlcov/* logs/*


##@ Testing
test: clean ## Launches tox
@tox


bandit: ## Launches bandit via tox
@tox -e bandit


flake8: ## Launches flake8 via tox
@tox -e flake8


mypy: ## Launches mypy via tox
@tox -e mypy


quick-test: build ## Launches nosetest using the default python
@$(PYTHON) -B setup.py test $(NOSEARGS)


##@ RPMs
srpm: $(ARCHIVE) ## Produce an SRPM from the archive
@rpmbuild \
--define "_srcrpmdir dist" \
--define "dist %{nil}" \
-ts "$(ARCHIVE)"


rpm: $(ARCHIVE) ## Produce an RPM from the archive
@rpmbuild --define "_rpmdir dist" -tb "$(ARCHIVE)"


archive: $(ARCHIVE) ## Extracts an archive from the current git commit


# newer versions support the --format tar.gz but we're intending to work all
# the way back to RHEL 6 which does not have that.
$(ARCHIVE):
@git archive HEAD \
--format tar --prefix "python-$(PROJECT)-$(VERSION)/" \
| gzip > "$(ARCHIVE)"


##@ Documentation
docs: clean-docs docs/overview.rst ## Build sphinx docs
@tox -e sphinx


overview: docs/overview.rst ## rebuilds the overview from README.md


docs/overview.rst: README.md
@sed 's/^\[\!.*/ /g' $< > overview.md && \
pandoc --from=markdown --to=rst -o $@ "overview.md" && \
rm -f overview.md


pull-docs: ## Refreshes the gh-pages submodule
@git submodule init
@git submodule update --remote gh-pages


stage-docs: docs pull-docs ## Builds docs and stages them in gh-pages
@pushd gh-pages >/dev/null && \
rm -rf * && \
touch .nojekyll ; \
popd >/dev/null ; \
cp -vr build/sphinx/dirhtml/* gh-pages/


deploy-docs: stage-docs ## Builds, stages, and deploys docs to gh-pages
@pushd gh-pages >/dev/null && \
git remote set-url --push origin $(ORIGIN_PUSH) ; \
git add -A && git commit -m "deploying sphinx update" && git push ; \
popd >/dev/null ; \
if [ `git diff --name-only gh-pages` ] ; then \
git add gh-pages ; \
git commit -m "docs deploy [ci skip]" -o gh-pages ; \
fi


clean-docs: ## Remove built docs
@rm -rf build/sphinx/*


.PHONY: archive build clean clean-built clean-docs default deploy-docs docs flake8 help mypy overview quick-test rpm srpm stage-docs test tidy


# The end.
52 changes: 34 additions & 18 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Overview of python-javatools

A `python <http://python.org>`__ module for unpacking and inspecting
`Java <http://www.oracle.com/technetwork/java/index.html>`__ Class
files, JARs, and collections of either.
files, JARs, and collections of either. Supporting features up to JDK 8.

It can do deep checking of classes to perform comparisons of
functionality, and output reports in multiple formats.
Expand All @@ -19,48 +19,60 @@ github. Or heck, just fork it!
Requirements
------------

- `Python <http://python.org>`__ 2.6 or later (no support for Python 3)
- `Setuptools <http://pythonhosted.org/setuptools/>`__
- `Cheetah <http://www.cheetahtemplate.org>`__ is used in the
- `Python <http://python.org>`__ 2.7, 3.7, 3.8, 3.9, 3.10, 3.11
- `Setuptools <https://pypi.org/project/setuptools/>`__
- `Six <https://pypi.org/project/six/>`__
- `Cheetah3 <http://www.cheetahtemplate.org>`__ is used in the
generation of HTML reports
- `M2Crypto <https://gitlab.com/m2crypto/m2crypto/>`__ (optional) is
used for cryptographic operations

In addition, the following tools are used in building and testing the
project.

- `Tox <https://pypi.org/project/tox>`__
- `GNU Make <http://www.gnu.org/software/make/>`__
- `Pylint <http://pypi.python.org/pypi/pylint/>`__
- `Flake8 <https://pypi.org/project/flake8/>`__

All of these packages are available in most linux distributions (eg.
Fedora), and for OSX via `MacPorts <http://www.macports.org>`__.
Fedora), and for OSX via `MacPorts <http://www.macports.org>`__ and
`HomeBrew <https://brew.sh/>`__, or available directly from pip.

M2Crypto can be difficult on some platforms, and so is set as an
optional dependency. If an execution path attempts to perform an action
which requires M2Crypto (primarily Jar signing and Jar signature
verification), then a ``CryptoDisabled`` exception will be raised, or a
message will be printed to stdout explaining that the feature is
unavailable. See the `M2Crypto Install
Guide <https://gitlab.com/m2crypto/m2crypto/-/blob/master/INSTALL.rst>`__
for workarounds in your environment.

Building
--------

This module uses `setuptools <http://pythonhosted.org/setuptools/>`__,
This module uses `setuptools <https://pypi.org/project/setuptools/>`__,
so running the following will build the project:

``python setup.py build``

to install, run:

``sudo python setup.py install``
``python -m pip install . --user``

Testing
~~~~~~~

Tests are written as ``unittest`` test cases. If you'd like to run the
Tests are written as ``unittest`` test cases. If youd like to run the
tests, simply invoke:

``python setup.py test``

There is also a custom ``pylint`` command, which can be use via:

``python setup.py pylint``
or invoke tests across a wider range of platforms via ``tox``

RPM
~~~

If you'd prefer to build an RPM, see the wiki entry for `Building as an
If youd prefer to build an RPM, see the wiki entry for `Building as an
RPM <https://github.com/obriencj/python-javatools/wiki/Building-as-an-RPM>`__.

Javatools Scripts
Expand All @@ -77,7 +89,9 @@ Javatools Scripts
- jardiff - prints the deltas between the contents of a JAR, and runs
classdiff on differing Java class files contained in the JARs

- manifest - creates manifests, signs JAR with OpenSSL
- jarutil - creates and signs JARs, verifies JAR signatures

- manifest - creates and queries JAR manifests

- distinfo - prints information about a mixed multi-jar/class
distribution, such as provides/requires lists.
Expand All @@ -88,20 +102,22 @@ Javatools Scripts
Additional References
---------------------

- Oracle's Java Virtual Machine Specification `Chapter 4 "The class
- Oracles Java Virtual Machine Specification `Chapter 4 The class
File
Format" <http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html>`__
Format <http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html>`__
- `Java Archive (JAR)
Files <http://docs.oracle.com/javase/1.5.0/docs/guide/jar/index.html>`__

Contact
-------

Christopher O'Brien [email protected]
Author: Christopher OBrien [email protected]

If you're interested in my other projects, feel free to visit `my
If youre interested in my other projects, feel free to visit `my
blog <http://obriencj.preoccupied.net/>`__.

Original Git Repository: https://github.com/obriencj/python-javatools

License
-------

Expand Down
1 change: 1 addition & 0 deletions gh-pages
Submodule gh-pages added at 24dfb9
Loading

0 comments on commit 0264da3

Please sign in to comment.