Skip to content

Commit dd68dec

Browse files
committed
Bring tooling up to date (Makefiles etc.)
1 parent 90cf2ab commit dd68dec

File tree

7 files changed

+227
-92
lines changed

7 files changed

+227
-92
lines changed

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
language: python
22
python:
3+
- "3.6"
4+
- "3.5"
35
- "3.4"
46
- "3.3"
57
- "3.2"
68
- "2.7"
9+
- "pypy3"
710
- "pypy"
811
install: "pip install -e .[test]"
912
script: make test

Makefile

+59-46
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ PYTHON=python
2727
PIP=pip
2828
PYTEST=py.test
2929
COVERAGE=coverage
30+
TWINE=twine
3031
PYFLAGS=
3132
DEST_DIR=/
3233

@@ -41,16 +42,17 @@ endif
4142
# Calculate the base names of the distribution, the location of all source,
4243
# documentation, packaging, icon, and executable script files
4344
NAME:=$(shell $(PYTHON) $(PYFLAGS) setup.py --name)
45+
PKG_DIR:=$(subst -,_,$(NAME))
4446
VER:=$(shell $(PYTHON) $(PYFLAGS) setup.py --version)
47+
DEB_ARCH:=$(shell dpkg --print-architecture)
4548
ifeq ($(shell lsb_release -si),Ubuntu)
46-
DEB_SUFFIX:=~ppa1
49+
DEB_SUFFIX:=ubuntu1
4750
else
4851
DEB_SUFFIX:=
4952
endif
50-
PYVER:=$(shell $(PYTHON) $(PYFLAGS) -c "import sys; print('py%d.%d' % sys.version_info[:2])")
5153
PY_SOURCES:=$(shell \
5254
$(PYTHON) $(PYFLAGS) setup.py egg_info >/dev/null 2>&1 && \
53-
grep -v "\.egg-info" $(NAME).egg-info/SOURCES.txt)
55+
grep -v "\.egg-info" $(PKG_DIR).egg-info/SOURCES.txt)
5456
DEB_SOURCES:=debian/changelog \
5557
debian/control \
5658
debian/copyright \
@@ -65,19 +67,28 @@ DEB_SOURCES:=debian/changelog \
6567
DOC_SOURCES:=docs/conf.py \
6668
$(wildcard docs/*.png) \
6769
$(wildcard docs/*.svg) \
70+
$(wildcard docs/*.dot) \
71+
$(wildcard docs/*.mscgen) \
72+
$(wildcard docs/*.gpi) \
6873
$(wildcard docs/*.rst) \
6974
$(wildcard docs/*.pdf)
75+
SUBDIRS:=
7076

7177
# Calculate the name of all outputs
72-
DIST_EGG=dist/$(NAME)-$(VER)-$(PYVER).egg
78+
DIST_WHEEL=dist/$(NAME)-$(VER)-py2.py3-none-any.whl
7379
DIST_TAR=dist/$(NAME)-$(VER).tar.gz
7480
DIST_ZIP=dist/$(NAME)-$(VER).zip
75-
DIST_DEB=dist/python-$(NAME)_$(VER)-1$(DEB_SUFFIX)_all.deb \
76-
dist/python3-$(NAME)_$(VER)-1$(DEB_SUFFIX)_all.deb \
77-
dist/python-$(NAME)-docs_$(VER)-1$(DEB_SUFFIX)_all.deb
78-
DIST_DSC=dist/$(NAME)_$(VER)-1$(DEB_SUFFIX).tar.gz \
79-
dist/$(NAME)_$(VER)-1$(DEB_SUFFIX).dsc \
80-
dist/$(NAME)_$(VER)-1$(DEB_SUFFIX)_source.changes
81+
DIST_DEB=dist/python-$(NAME)_$(VER)$(DEB_SUFFIX)_all.deb \
82+
dist/python3-$(NAME)_$(VER)$(DEB_SUFFIX)_all.deb \
83+
dist/python-$(NAME)-docs_$(VER)$(DEB_SUFFIX)_all.deb \
84+
dist/$(NAME)_$(VER)$(DEB_SUFFIX)_$(DEB_ARCH).build \
85+
dist/$(NAME)_$(VER)$(DEB_SUFFIX)_$(DEB_ARCH).buildinfo \
86+
dist/$(NAME)_$(VER)$(DEB_SUFFIX)_$(DEB_ARCH).changes
87+
DIST_DSC=dist/$(NAME)_$(VER)$(DEB_SUFFIX).tar.xz \
88+
dist/$(NAME)_$(VER)$(DEB_SUFFIX).dsc \
89+
dist/$(NAME)_$(VER)$(DEB_SUFFIX)_source.build \
90+
dist/$(NAME)_$(VER)$(DEB_SUFFIX)_source.buildinfo \
91+
dist/$(NAME)_$(VER)$(DEB_SUFFIX)_source.changes
8192
MAN_PAGES=
8293

8394

@@ -97,94 +108,96 @@ all:
97108
@echo "make release - Create and tag a new release"
98109
@echo "make upload - Upload the new release to repositories"
99110

100-
install:
111+
install: $(SUBDIRS)
101112
$(PYTHON) $(PYFLAGS) setup.py install --root $(DEST_DIR)
102113

103114
doc: $(DOC_SOURCES)
104-
$(MAKE) -C docs html latexpdf
115+
$(MAKE) -C docs clean
116+
$(MAKE) -C docs html
117+
$(MAKE) -C docs epub
118+
$(MAKE) -C docs latexpdf
105119

106120
source: $(DIST_TAR) $(DIST_ZIP)
107121

108-
egg: $(DIST_EGG)
122+
wheel: $(DIST_WHEEL)
109123

110124
zip: $(DIST_ZIP)
111125

112126
tar: $(DIST_TAR)
113127

114128
deb: $(DIST_DEB) $(DIST_DSC)
115129

116-
dist: $(DIST_EGG) $(DIST_DEB) $(DIST_DSC) $(DIST_TAR) $(DIST_ZIP)
130+
dist: $(DIST_WHEEL) $(DIST_DEB) $(DIST_DSC) $(DIST_TAR) $(DIST_ZIP)
117131

118132
develop: tags
133+
@# These have to be done separately to avoid a cockup...
134+
$(PIP) install -U setuptools
135+
$(PIP) install -U pip
136+
$(PIP) install -U tox
137+
$(PIP) install virtualenv==13
119138
$(PIP) install -e .[doc,test]
120139

121140
test:
122-
$(COVERAGE) run -m $(PYTEST) tests -v
141+
$(COVERAGE) run --rcfile coverage.cfg -m $(PYTEST) tests
123142
$(COVERAGE) report --rcfile coverage.cfg
124143

125144
clean:
126-
$(PYTHON) $(PYFLAGS) setup.py clean
127-
$(MAKE) -f $(CURDIR)/debian/rules clean
128-
$(MAKE) -C docs clean
129-
rm -fr build/ dist/ $(NAME).egg-info/ tags
145+
dh_clean
146+
rm -fr dist/ $(NAME).egg-info/ tags
147+
for dir in $(SUBDIRS); do \
148+
$(MAKE) -C $$dir clean; \
149+
done
130150
find $(CURDIR) -name "*.pyc" -delete
131151

132152
tags: $(PY_SOURCES)
133153
ctags -R --exclude="build/*" --exclude="debian/*" --exclude="docs/*" --languages="Python"
134154

135-
$(MAN_PAGES): $(DOC_SOURCES)
136-
$(MAKE) -C docs man
137-
mkdir -p man/
138-
cp docs/_build/man/*.1 man/
155+
$(SUBDIRS):
156+
$(MAKE) -C $@
139157

140-
$(DIST_TAR): $(PY_SOURCES)
158+
$(DIST_TAR): $(PY_SOURCES) $(SUBDIRS)
141159
$(PYTHON) $(PYFLAGS) setup.py sdist --formats gztar
142160

143-
$(DIST_ZIP): $(PY_SOURCES)
161+
$(DIST_ZIP): $(PY_SOURCES) $(SUBDIRS)
144162
$(PYTHON) $(PYFLAGS) setup.py sdist --formats zip
145163

146-
$(DIST_EGG): $(PY_SOURCES)
147-
$(PYTHON) $(PYFLAGS) setup.py bdist_egg
164+
$(DIST_WHEEL): $(PY_SOURCES) $(SUBDIRS)
165+
$(PYTHON) $(PYFLAGS) setup.py bdist_wheel --universal
148166

149-
$(DIST_DEB): $(PY_SOURCES) $(DEB_SOURCES) $(MAN_PAGES)
167+
$(DIST_DEB): $(PY_SOURCES) $(SUBDIRS) $(DEB_SOURCES)
150168
# build the binary package in the parent directory then rename it to
151169
# project_version.orig.tar.gz
152170
$(PYTHON) $(PYFLAGS) setup.py sdist --dist-dir=../
153171
rename -f 's/$(NAME)-(.*)\.tar\.gz/$(NAME)_$$1\.orig\.tar\.gz/' ../*
154-
debuild -b -i -I -Idist -Ibuild -Idocs/_build -Icoverage -I__pycache__ -I.coverage -Itags -I*.pyc -I*.vim -I*.xcf -rfakeroot
172+
debuild -b
155173
mkdir -p dist/
156174
for f in $(DIST_DEB); do cp ../$${f##*/} dist/; done
157175

158-
$(DIST_DSC): $(PY_SOURCES) $(DEB_SOURCES) $(MAN_PAGES)
176+
$(DIST_DSC): $(PY_SOURCES) $(SUBDIRS) $(DEB_SOURCES)
159177
# build the source package in the parent directory then rename it to
160178
# project_version.orig.tar.gz
161179
$(PYTHON) $(PYFLAGS) setup.py sdist --dist-dir=../
162180
rename -f 's/$(NAME)-(.*)\.tar\.gz/$(NAME)_$$1\.orig\.tar\.gz/' ../*
163-
debuild -S -i -I -Idist -Ibuild -Idocs/_build -Icoverage -I__pycache__ -I.coverage -Itags -I*.pyc -I*.vim -I*.xcf -rfakeroot
181+
debuild -S
164182
mkdir -p dist/
165183
for f in $(DIST_DSC); do cp ../$${f##*/} dist/; done
166184

167-
release: $(PY_SOURCES) $(DOC_SOURCES) $(DEB_SOURCES)
185+
changelog: $(PY_SOURCES) $(DOC_SOURCES) $(DEB_SOURCES)
168186
$(MAKE) clean
169187
# ensure there are no current uncommitted changes
170188
test -z "$(shell git status --porcelain)"
171-
# update the changelog with new release information
172-
dch --newversion $(VER)-1$(DEB_SUFFIX) --controlmaint
173-
# ensure all packages build successfully before committing
174-
$(MAKE) dist
189+
# update the debian changelog with new release information
190+
dch --newversion $(VER)$(DEB_SUFFIX)
175191
# commit the changes and add a new tag
176192
git commit debian/changelog -m "Updated changelog for release $(VER)"
177-
git tag -s release-$(VER) -m "Release $(VER)"
178-
# update the package's registration on PyPI (in case any metadata's changed)
179-
$(PYTHON) $(PYFLAGS) setup.py register
180193

181-
upload: $(PY_SOURCES) $(DOC_SOURCES) $(DIST_DEB) $(DIST_DSC)
182-
# build a source archive and upload to PyPI
183-
$(PYTHON) $(PYFLAGS) setup.py sdist upload
184-
# build the deb source archive and upload to the PPA
185-
dput waveform-ppa dist/$(NAME)_$(VER)-1$(DEB_SUFFIX)_source.changes
194+
release: $(DIST_DEB) $(DIST_DSC) $(DIST_TAR) $(DIST_WHEEL)
195+
git tag -s release-$(VER) -m "Release $(VER)"
186196
git push --tags
187197
git push
198+
# build a source archive and upload to PyPI
199+
$(TWINE) upload $(DIST_TAR) $(DIST_WHEEL)
200+
# build the deb source archive and upload to the PPA
201+
dput waveform-ppa dist/$(NAME)_$(VER)$(DEB_SUFFIX)_source.changes
188202

189-
.PHONY: all install develop test doc source egg zip tar deb dist clean tags release upload
190-
203+
.PHONY: all install develop test doc source wheel zip tar deb dist clean tags changelog release $(SUBDIRS)

docs/Makefile

+49-12
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
8-
BUILDDIR = _build
9-
DOT_DIAGRAMS = $(wildcard *.dot)
10-
MSC_DIAGRAMS = $(wildcard *.mscgen)
11-
SVG_IMAGES = $(wildcard *.svg) $(DOT_DIAGRAMS:%.dot=%.svg) $(MSC_DIAGRAMS:%.mscgen=%.svg)
12-
PDF_IMAGES = $(SVG_IMAGES:%.svg=%.pdf)
8+
BUILDDIR = ../build
9+
DOT_DIAGRAMS := $(wildcard images/*.dot)
10+
MSC_DIAGRAMS := $(wildcard images/*.mscgen)
11+
GPI_DIAGRAMS := $(wildcard images/*.gpi)
12+
SVG_IMAGES := $(wildcard images/*.svg) $(DOT_DIAGRAMS:%.dot=%.svg) $(MSC_DIAGRAMS:%.mscgen=%.svg)
13+
PNG_IMAGES := $(wildcard images/*.png) $(GPI_DIAGRAMS:%.gpi=%.png) $(SVG_IMAGES:%.svg=%.png)
14+
PDF_IMAGES := $(SVG_IMAGES:%.svg=%.pdf) $(GPI_DIAGRAMS:%.gpi=%.pdf) $(DOT_DIAGRAMS:%.dot=%.pdf) $(MSC_DIAGRAMS:%.mscgen=%.pdf)
15+
16+
# User-friendly check for sphinx-build
17+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
18+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
19+
endif
1320

1421
# Internal variables.
1522
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -18,8 +25,6 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1825
# the i18n builder cannot share the environment and doctrees with the others
1926
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
2027

21-
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
22-
2328
help:
2429
@echo "Please use \`make <target>' where <target> is one of"
2530
@echo " html to make standalone HTML files"
@@ -33,29 +38,32 @@ help:
3338
@echo " epub to make an epub"
3439
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
3540
@echo " latexpdf to make LaTeX files and run them through pdflatex"
41+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
3642
@echo " text to make text files"
3743
@echo " man to make manual pages"
3844
@echo " texinfo to make Texinfo files"
3945
@echo " info to make Texinfo files and run them through makeinfo"
4046
@echo " gettext to make PO message catalogs"
4147
@echo " changes to make an overview of all changed/added/deprecated items"
48+
@echo " xml to make Docutils-native XML files"
49+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
4250
@echo " linkcheck to check all external links for integrity"
4351
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
4452

4553
clean:
46-
-rm -rf $(BUILDDIR)/*
54+
rm -rf $(BUILDDIR)/*
4755

48-
html: $(SVG_IMAGES)
56+
html: $(SVG_IMAGES) $(PNG_IMAGES)
4957
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5058
@echo
5159
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
5260

53-
dirhtml: $(SVG_IMAGES)
61+
dirhtml: $(SVG_IMAGES) $(PNG_IMAGES)
5462
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
5563
@echo
5664
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
5765

58-
singlehtml: $(SVG_IMAGES)
66+
singlehtml: $(SVG_IMAGES) $(PNG_IMAGES)
5967
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
6068
@echo
6169
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
@@ -112,6 +120,12 @@ latexpdf: $(PDF_IMAGES)
112120
$(MAKE) -C $(BUILDDIR)/latex all-pdf
113121
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
114122

123+
latexpdfja: $(PDF_IMAGES)
124+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125+
@echo "Running LaTeX files through platex and dvipdfmx..."
126+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
127+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128+
115129
text:
116130
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
117131
@echo
@@ -156,12 +170,35 @@ doctest:
156170
@echo "Testing of doctests in the sources finished, look at the " \
157171
"results in $(BUILDDIR)/doctest/output.txt."
158172

159-
%.svg: %.msc
173+
xml:
174+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
175+
@echo
176+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
177+
178+
pseudoxml:
179+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
180+
@echo
181+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
182+
183+
%.svg: %.mscgen
160184
mscgen -T svg -o $@ $<
161185

162186
%.svg: %.dot
163187
dot -T svg -o $@ $<
164188

189+
%.png: %.gpi
190+
gnuplot -e "set term pngcairo transparent size 400,400" $< > $@
191+
192+
%.png: %.svg
193+
inkscape -e $@ $<
194+
165195
%.pdf: %.svg
166196
inkscape -A $@ $<
167197

198+
%.pdf: %.gpi
199+
gnuplot -e "set term pdfcairo size 5cm,5cm" $< > $@
200+
201+
%.pdf: %.mscgen
202+
mscgen -T eps -o - $< | ps2pdf -dEPSCrop - $@
203+
204+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext

docs/_static/style_override.css

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* override table width restrictions */
2+
.wy-table-responsive table td, .wy-table-responsive table th {
3+
/* !important prevents the common CSS stylesheets from
4+
overriding this as on RTD they are loaded after this stylesheet */
5+
white-space: normal !important;
6+
}
7+
8+
.wy-table-responsive {
9+
overflow: visible !important;
10+
}

0 commit comments

Comments
 (0)