File: rules

package info (click to toggle)
python-twitter 1.1%2Bgit20131227-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 884 kB
  • ctags: 1,148
  • sloc: python: 5,150; makefile: 187
file content (55 lines) | stat: -rwxr-xr-x 2,288 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/make -f

%:
	dh "$@" --with python2,sphinxdoc --buildsystem=python_distutils

override_dh_auto_build:
	dh_auto_build
	cd $(CURDIR)/doc && $(MAKE) html

override_dh_auto_install:
	dh_auto_install
	install -m 755 $(CURDIR)/examples/tweet.py $(CURDIR)/debian/python-twitter/usr/bin/tweet
	install -m 755 $(CURDIR)/examples/twitter-to-xhtml.py $(CURDIR)/debian/python-twitter/usr/bin/twitter-to-xhtml

override_dh_auto_clean:
	dh_auto_clean
	cd $(CURDIR)/doc && $(MAKE) clean
	rm -rf $(CURDIR)/python_twitter.egg-info

override_dh_compress:
	dh_compress -X.js -X.inv

override_dh_sphinxdoc:
	(! test -d $(CURDIR)/debian/python-twitter-doc || dh_sphinxdoc)

PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER  = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')

## http://wiki.debian.org/onlyjob/get-orig-source
.PHONY: get-orig-source
get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE))
	@

UURL = git://github.com/bear/python-twitter.git
UDATE = $(shell date --rfc-3339=seconds --date='TZ="UTC" $(shell echo $(VER) | perl -ne 'print "$$1-$$2-$$3" if m/\+(?:git|svn|hg)(\d{4})(\d{2})(\d{2})/')')
$(PKG)_$(VER)$(DTYPE).orig.tar.xz: $(info I: UDATE=$(UDATE))
	$(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting..))
	@echo "# Downloading..."
	git clone $(UURL) $(PKG)-$(VER) \
	|| $(RM) -r $(PKG)-$(VER)
	cd $(PKG)-$(VER) \
	&& git checkout v$(VER) || git checkout $$(git log -n1 --format=%h --before="$(UDATE)") \
	&& [ -s ChangeLog ] || ( echo "# Generating ChangeLog..." \
	   ; git log --pretty="format:%ad  %aN  <%aE>%n%n%x09* %s%n" --date=short > ChangeLog \
	   ; touch -d "$$(git log -1 --format='%ci')" ChangeLog) \
	&& echo "# Setting times..." \
	&& for F in $$(git ls-tree -r --name-only HEAD); do touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; done \
	&& echo "# Cleaning-up..." \
	&& $(RM) -r simplejson doc/_build \
	&& $(RM) -r .git .git*
	@echo "# Packing..."
	find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
	| XZ_OPT="-6v" tar -caf "$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
	&& $(RM) -r "$(PKG)-$(VER)"