Skip to content

Commit 0264da3

Browse files
authored
Prep v1.6.0 (#132)
* 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
1 parent 0b1582d commit 0264da3

File tree

8 files changed

+381
-70
lines changed

8 files changed

+381
-70
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,4 @@ jobs:
8181
uses: pypa/gh-action-pypi-publish@release/v1
8282

8383

84-
announce:
85-
name: Announce release to @[email protected]
86-
runs-on: ubuntu-latest
87-
88-
needs:
89-
- publish
90-
91-
steps:
92-
- name: Get current date
93-
id: date
94-
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
95-
96-
- name: Create announcement post
97-
uses: rzr/fediverse-action@master
98-
with:
99-
host: fosstodon.org
100-
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
101-
102-
message: |
103-
Version ${{ github.ref }} of python-javatools was released on ${{ steps.date.outputs.date }}
104-
https://github.com/obriencj/python-javatools/releases/tag/${{ github.ref }}
105-
\#python \#javatools
106-
107-
10884
# The end.

.github/workflows/tox.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ on:
1414
ignore-paths:
1515
- 'docs/**'
1616
paths:
17-
- '*.py'
18-
- '*.tmpl'
17+
- 'setup.*'
18+
- '**/*.py'
19+
- '**/*.tmpl'
1920
- 'tests/**'
2021

2122
pull_request:
2223
ignore-paths:
2324
- 'docs/**'
2425
paths:
25-
- '*.py'
26-
- '*.tmpl'
26+
- 'setup.*'
27+
- '**/*.py'
28+
- '**/*.tmpl'
2729
- 'tests/**'
2830

2931

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "gh-pages"]
2+
path = gh-pages
3+
url = ./
4+
branch = gh-pages

Makefile

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Sorry that this Makefile is a bit of a disaster.
2+
3+
4+
PYTHON ?= $(shell which python3 python 2>/dev/null | head -n1)
5+
PYTHON := $(PYTHON)
6+
7+
8+
PROJECT := $(shell $(PYTHON) ./setup.py --name)
9+
VERSION := $(shell $(PYTHON) ./setup.py --version)
10+
11+
ARCHIVE := python-$(PROJECT)-$(VERSION).tar.gz
12+
13+
14+
# We use this later in setting up the gh-pages submodule for pushing,
15+
# so forks will push their docs to their own gh-pages branch.
16+
ORIGIN_PUSH = $(shell git remote get-url --push origin)
17+
18+
19+
##@ Basic Targets
20+
default: quick-test ## Runs the quick-test target
21+
22+
23+
help: ## Display this help
24+
@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)
25+
26+
27+
report-python:
28+
@echo "Using python" $(PYTHON)
29+
@$(PYTHON) -VV
30+
31+
32+
##@ Local Build and Install
33+
build: clean-built report-python flake8 ## Produces a wheel using the default system python
34+
@$(PYTHON) setup.py bdist_wheel
35+
36+
37+
install: quick-test ## Installs using the default python for the current user
38+
@$(PYTHON) -B -m pip.__main__ \
39+
install --no-deps --user -I \
40+
dist/$(PROJECT)-$(VERSION)-py3-none-any.whl
41+
42+
43+
##@ Cleanup
44+
tidy: ## Removes stray eggs and .pyc files
45+
@rm -rf *.egg-info
46+
@find -H . \
47+
\( -iname '.tox' -o -iname '.eggs' -prune \) -o \
48+
\( -type d -iname '__pycache__' -exec rm -rf {} + \) -o \
49+
\( -type f -iname '*.pyc' -exec rm -f {} + \)
50+
51+
52+
clean-built:
53+
@rm -rf build/* dist/*
54+
@if [ -f ./"$(ARCHIVE)" ] ; then rm -f ./"$(ARCHIVE)" ; fi
55+
56+
57+
clean: clean-built tidy ## Removes built content, test logs, coverage reports
58+
@rm -rf .coverage* htmlcov/* logs/*
59+
60+
61+
##@ Testing
62+
test: clean ## Launches tox
63+
@tox
64+
65+
66+
bandit: ## Launches bandit via tox
67+
@tox -e bandit
68+
69+
70+
flake8: ## Launches flake8 via tox
71+
@tox -e flake8
72+
73+
74+
mypy: ## Launches mypy via tox
75+
@tox -e mypy
76+
77+
78+
quick-test: build ## Launches nosetest using the default python
79+
@$(PYTHON) -B setup.py test $(NOSEARGS)
80+
81+
82+
##@ RPMs
83+
srpm: $(ARCHIVE) ## Produce an SRPM from the archive
84+
@rpmbuild \
85+
--define "_srcrpmdir dist" \
86+
--define "dist %{nil}" \
87+
-ts "$(ARCHIVE)"
88+
89+
90+
rpm: $(ARCHIVE) ## Produce an RPM from the archive
91+
@rpmbuild --define "_rpmdir dist" -tb "$(ARCHIVE)"
92+
93+
94+
archive: $(ARCHIVE) ## Extracts an archive from the current git commit
95+
96+
97+
# newer versions support the --format tar.gz but we're intending to work all
98+
# the way back to RHEL 6 which does not have that.
99+
$(ARCHIVE):
100+
@git archive HEAD \
101+
--format tar --prefix "python-$(PROJECT)-$(VERSION)/" \
102+
| gzip > "$(ARCHIVE)"
103+
104+
105+
##@ Documentation
106+
docs: clean-docs docs/overview.rst ## Build sphinx docs
107+
@tox -e sphinx
108+
109+
110+
overview: docs/overview.rst ## rebuilds the overview from README.md
111+
112+
113+
docs/overview.rst: README.md
114+
@sed 's/^\[\!.*/ /g' $< > overview.md && \
115+
pandoc --from=markdown --to=rst -o $@ "overview.md" && \
116+
rm -f overview.md
117+
118+
119+
pull-docs: ## Refreshes the gh-pages submodule
120+
@git submodule init
121+
@git submodule update --remote gh-pages
122+
123+
124+
stage-docs: docs pull-docs ## Builds docs and stages them in gh-pages
125+
@pushd gh-pages >/dev/null && \
126+
rm -rf * && \
127+
touch .nojekyll ; \
128+
popd >/dev/null ; \
129+
cp -vr build/sphinx/dirhtml/* gh-pages/
130+
131+
132+
deploy-docs: stage-docs ## Builds, stages, and deploys docs to gh-pages
133+
@pushd gh-pages >/dev/null && \
134+
git remote set-url --push origin $(ORIGIN_PUSH) ; \
135+
git add -A && git commit -m "deploying sphinx update" && git push ; \
136+
popd >/dev/null ; \
137+
if [ `git diff --name-only gh-pages` ] ; then \
138+
git add gh-pages ; \
139+
git commit -m "docs deploy [ci skip]" -o gh-pages ; \
140+
fi
141+
142+
143+
clean-docs: ## Remove built docs
144+
@rm -rf build/sphinx/*
145+
146+
147+
.PHONY: archive build clean clean-built clean-docs default deploy-docs docs flake8 help mypy overview quick-test rpm srpm stage-docs test tidy
148+
149+
150+
# The end.

docs/overview.rst

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Overview of python-javatools
33

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

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

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

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

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

3337
All of these packages are available in most linux distributions (eg.
34-
Fedora), and for OSX via `MacPorts <http://www.macports.org>`__.
38+
Fedora), and for OSX via `MacPorts <http://www.macports.org>`__ and
39+
`HomeBrew <https://brew.sh/>`__, or available directly from pip.
40+
41+
M2Crypto can be difficult on some platforms, and so is set as an
42+
optional dependency. If an execution path attempts to perform an action
43+
which requires M2Crypto (primarily Jar signing and Jar signature
44+
verification), then a ``CryptoDisabled`` exception will be raised, or a
45+
message will be printed to stdout explaining that the feature is
46+
unavailable. See the `M2Crypto Install
47+
Guide <https://gitlab.com/m2crypto/m2crypto/-/blob/master/INSTALL.rst>`__
48+
for workarounds in your environment.
3549

3650
Building
3751
--------
3852

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

4256
``python setup.py build``
4357

4458
to install, run:
4559

46-
``sudo python setup.py install``
60+
``python -m pip install . --user``
4761

4862
Testing
4963
~~~~~~~
5064

51-
Tests are written as ``unittest`` test cases. If you'd like to run the
65+
Tests are written as ``unittest`` test cases. If youd like to run the
5266
tests, simply invoke:
5367

5468
``python setup.py test``
5569

56-
There is also a custom ``pylint`` command, which can be use via:
57-
58-
``python setup.py pylint``
70+
or invoke tests across a wider range of platforms via ``tox``
5971

6072
RPM
6173
~~~
6274

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

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

80-
- manifest - creates manifests, signs JAR with OpenSSL
92+
- jarutil - creates and signs JARs, verifies JAR signatures
93+
94+
- manifest - creates and queries JAR manifests
8195

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

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

97111
Contact
98112
-------
99113

100-
Christopher O'Brien [email protected]
114+
Author: Christopher OBrien [email protected]
101115

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

119+
Original Git Repository: https://github.com/obriencj/python-javatools
120+
105121
License
106122
-------
107123

gh-pages

Submodule gh-pages added at 24dfb93

0 commit comments

Comments
 (0)