Skip to content

Commit f1d0fcf

Browse files
author
cboos
committed
1.0.14dev: add release related tasks to the Makefile
This is the first half of the Trac release automation enhancements. `make release` builds the packages relevant for each platform (`release-exe` builds the .exe installers on Windows and `release-src` the source packages on Unix). `make upload version=1.x.y` then copies the packages on lynx, in the user's `dist` folder over there, which has to exist. The second half is in the `update-latest.sh` script on lynx, which expects the packages to be in the `$SUDO_USER`'s `~/dist` folder, and moves them to the appropriate places for distribution on t.e.o. git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.0-stable@15277 af82e41b-90c4-0310-8c96-b1721e28e2e2
1 parent bf1c456 commit f1d0fcf

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

Makefile

+97
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ define HELP
9595
[epydocopts=...] variable containing extra options for Epydoc
9696
[dotpath=/.../dot] path to Graphviz dot program (not used yet)
9797

98+
---------------- Release tasks
99+
100+
release release-exe on Windows, release-src otherwise
101+
release-src generates the .tar.gz, .zip and .whl packages
102+
release-exe generates the Windows installers (32- and 64-bits)
103+
release-clean remove the packages
104+
105+
checksum MD5 and SHA1 checksums of packages of given version
106+
upload scp the packages of given version to user@lynx:~/dist
107+
108+
[version=...] version number, mandatory for checksum and upload
109+
98110
---------------- Miscellaneous
99111

100112
start-admin start trac-admin (on `env')
@@ -552,6 +564,91 @@ clean-doc:
552564
rm -fr build/doc
553565

554566

567+
# ----------------------------------------------------------------------------
568+
#
569+
# Release related tasks
570+
#
571+
# ----------------------------------------------------------------------------
572+
573+
.PHONY: release release-src wheel dist release-exe wininst
574+
.PHONY: clean-release checksum upload
575+
576+
ifeq "$(OS)" "Windows_NT"
577+
release: release-exe
578+
else # !Windows_NT
579+
release: release-src
580+
endif # Windows_NT
581+
582+
clean-release:
583+
ifeq "$(version)" ""
584+
$(error "specify version= on the make command-line")
585+
else
586+
@rm $(sdist+wheel) $(wininst)
587+
endif
588+
589+
user ?= $(or $(USER),$(LOGNAME),$(USERNAME))
590+
lynx = $(user)@lynx.edgewall.com:/home/$(user)/dist
591+
SCP ?= scp
592+
593+
release-src: wheel sdist
594+
595+
wheel:
596+
@$(PYTHON) setup.py bdist_wheel
597+
sdist:
598+
@$(PYTHON) setup.py sdist --formats=gztar,zip
599+
600+
sdist+wheel = $(sdist_gztar) $(sdist_zip) $(bdist_wheel)
601+
602+
sdist_gztar = dist/Trac-$(version).tar.gz
603+
sdist_zip = dist/Trac-$(version).zip
604+
bdist_wheel = dist/Trac-$(version)-py2-none-any.whl
605+
606+
607+
ifeq "$(OS)" "Windows_NT"
608+
release-exe:
609+
ifdef python.x86
610+
make python=x86 wininst
611+
else
612+
$(error "define python.x86 in Makefile.cfg for building $(wininst.x86)")
613+
endif
614+
ifdef python.x64
615+
make python=x64 wininst
616+
else
617+
$(error "define python.x64 in Makefile.cfg for building $(wininst.x64)")
618+
endif
619+
620+
wininst = $(wininst.x86) $(wininst.x64)
621+
622+
wininst.x86 = dist/Trac-$(version).win32.exe
623+
wininst.x64 = dist/Trac-$(version).win-amd64.exe
624+
625+
wininst:
626+
@$(PYTHON) setup.py bdist_wininst
627+
endif # Windows_NT
628+
629+
packages = $(wildcard $(sdist+wheel) $(wininst))
630+
631+
checksum:
632+
ifeq "$(version)" ""
633+
$(error "specify version= on the make command-line")
634+
else
635+
@echo "Packages for Trac-$(version):"
636+
@echo
637+
@$(if $(packages), \
638+
md5sum $(packages); \
639+
sha1sum $(packages); \
640+
, \
641+
echo "No packages found: $(sdist+wheel) $(wininst)" \
642+
)
643+
endif
644+
645+
upload: checksum
646+
ifeq "$(user)" ""
647+
$(error "define user in Makefile.cfg for uploading to lynx")
648+
else
649+
$(if $(packages),$(SCP) $(packages) $(lynx))
650+
endif # user
651+
555652

556653
# ============================================================================
557654
#

Makefile.cfg.sample

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ python.ap25 = C:/Dev/ActivePython254
1515
python.26 = C:/Dev/Python261
1616
python.27 = C:/Dev/Python278
1717

18+
python.x86 = C:/Dev/Python2712x86
19+
python.x64 = C:/Dev/Python2710x64
20+
# (mandatory for release-exe)
21+
1822
# And also:
1923

2024
# pythonpath.<key> = <extension to the PYTHONPATH for that installation>
@@ -73,6 +77,13 @@ auth = *,~/tracenvs/htdigest.realm,realm
7377

7478
dotpath = /usr/local/bin/dot
7579

80+
# ----------------------------------------------------------------------------
81+
# Settings for the release
82+
83+
# e.g. PuTTY's scp in Program Files (x86)
84+
# SCP = C:/PROGRA~2/PuTTY/pscp.exe
85+
86+
7687
# ----------------------------------------------------------------------------
7788
# Custom rules - let your imagination go wild ;-)
7889

0 commit comments

Comments
 (0)