Skip to content

Commit 2cac4f2

Browse files
committed
Add easy package build for deb and rpm
1 parent 436f21a commit 2cac4f2

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
SHELL = /bin/bash
2+
3+
VERSION := $(shell python -c 'from messaging import VERSION; print "%s.%s.%s" % VERSION')
4+
SOURCES := $(shell rpmbuild --eval '%{_topdir}' 2>/dev/null)/SOURCES
5+
PMV := python-messaging-$(VERSION)
6+
7+
all:
8+
@echo Usage: make deb\|rpm
9+
10+
rpm:
11+
@if [ ! -d $(SOURCES) ] ;\
12+
then\
13+
echo 'SOURCES does not exist, are you running on a non RPM based system?';\
14+
exit 1;\
15+
fi
16+
17+
tar -zcvf $(SOURCES)/$(PMV).tar.gz --exclude=.git --transform="s/^\./$(PMV)/" .
18+
rpmbuild -ba python-messaging.spec
19+
20+
deb:
21+
@if [ ! -d /var/lib/dpkg ] ;\
22+
then\
23+
echo 'Debian package directory does not exist, are you running on a non Debian based system?';\
24+
exit 1;\
25+
fi
26+
27+
@if ! head -1 debian/changelog | grep -q $(VERSION) ;\
28+
then\
29+
echo Changelog and package version are different;\
30+
exit 1;\
31+
fi
32+
33+
dpkg-buildpackage -rfakeroot;

python-messaging.spec

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
2+
3+
Name: python-messaging
4+
Version: %(%{__python} -c 'from messaging import VERSION; print "%s.%s.%s" % VERSION')
5+
Release: 1%{?dist}
6+
Summary: SMS encoder/decoder library
7+
License: GPL
8+
Group: Development
9+
Source: %{name}-%{version}.tar.gz
10+
BuildRoot: %{_tmppath}/%{name}-buildroot
11+
BuildArch: noarch
12+
13+
BuildRequires: python-devel
14+
%if 0%{?fedora} >= 8
15+
BuildRequires: python-setuptools-devel
16+
%else
17+
BuildRequires: python-setuptools
18+
%endif
19+
20+
%description
21+
Pure python SMS encoder/decoder library
22+
23+
%prep
24+
%setup -q -n %{name}-%{version}
25+
26+
%build
27+
%{__python} -c 'import setuptools; execfile("setup.py")' build
28+
29+
%install
30+
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
31+
%{__python} -c 'import setuptools; execfile("setup.py")' install -O1 --skip-build --root %{buildroot} --prefix=%{_prefix}
32+
33+
%clean
34+
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
35+
36+
%files
37+
%{python_sitelib}
38+
%defattr(-,root,root,-)
39+
%doc README
40+
41+
%changelog
42+
43+
* Mon Jun 06 2011 - Andrew Bird <[email protected]> - 0.5.10
44+
- Initial release - Spec file tested on Fedora 14 / 15 and OpenSUSE 11.4

0 commit comments

Comments
 (0)