Skip to content

Commit 4c36265

Browse files
authored
Merge pull request C2Devel#1 from FATruden/rpm_build
add stuff for building RPMs for py2/py3
2 parents fe9fcf2 + 19e2511 commit 4c36265

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: sources clean
2+
3+
PYTHON := python
4+
PROGRAM := jsonrpclib
5+
PACKAGE := python-$(PROGRAM)
6+
VERSION := $(shell sed -n s/[[:space:]]*Version:[[:space:]]*//p $(PACKAGE).spec)
7+
8+
9+
sources: clean
10+
@git archive --format=tar --prefix="$(PROGRAM)-$(VERSION)/" \
11+
$(shell git rev-parse --verify HEAD) | gzip > "$(PROGRAM)-$(VERSION).tar.gz"
12+
13+
clean:
14+
@rm -rf build dist $(PROGRAM).egg-info $(PROGRAM)-*.tar.gz *.egg *.src.rpm

python-jsonrpclib.spec

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
%if 0%{?rhel} && 0%{?rhel} <= 6
2+
%{!?__python2: %global __python2 /usr/bin/python2}
3+
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
4+
%endif
5+
6+
%global dist_raw %(%{__grep} -oP "release \\K[0-9]+\\.[0-9]+" /etc/system-release | tr -d ".")
7+
8+
%if 0%{?fedora} > 12 || 0%{?rhel} && 0%{?dist_raw} >= 75
9+
%bcond_without python3
10+
%else
11+
%bcond_with python3
12+
%endif
13+
14+
# centos 7.2 and lower versions don't have %py2_* macros, so define it manually
15+
%if 0%{?rhel} && 0%{?dist_raw} <= 72
16+
%{!?py2_build: %global py2_build %py_build}
17+
%{!?py2_install: %global py2_install %py_install}
18+
%endif
19+
20+
%global pkgname jsonrpclib
21+
22+
Name: python-%{pkgname}
23+
Version: 0.4.0
24+
Release: CROC1%{?dist}
25+
Summary: JSON-RPC v2.0 client library for Python
26+
License: ASL 2.0
27+
URL: http://github.com/tcalmant/jsonrpclib/
28+
Source0: %{pkgname}-%{version}.tar.gz
29+
BuildArch: noarch
30+
31+
%global _description\
32+
This project is an implementation of the JSON-RPC v2.0 specification\
33+
(backwards-compatible) as a client library, for Python 2.7 and Python 3.\
34+
This version is a fork of jsonrpclib by Josh Marshall, usable with Pelix\
35+
remote services.\
36+
37+
%description %_description
38+
39+
%package -n python2-%{pkgname}
40+
Summary: %summary
41+
BuildRequires: python2-devel
42+
43+
%description -n python2-%{pkgname} %_description
44+
45+
%if %{with python3}
46+
%package -n python%{python3_pkgversion}-%{pkgname}
47+
Summary: %summary
48+
BuildRequires: python%{python3_pkgversion}
49+
50+
%description -n python%{python3_pkgversion}-%{pkgname} %_description
51+
%endif
52+
53+
54+
%prep
55+
%setup -q -n %{pkgname}-%{version}
56+
57+
58+
%build
59+
%py2_build
60+
61+
%if %{with python3}
62+
%py3_build
63+
%endif
64+
65+
66+
%install
67+
[ %buildroot = "/" ] || rm -rf %buildroot
68+
69+
%py2_install
70+
71+
%if %{with python3}
72+
%py3_install
73+
%endif
74+
75+
76+
%clean
77+
rm -rf %{buildroot}
78+
79+
80+
%files -n python2-%{pkgname}
81+
%license LICENSE
82+
%{python2_sitelib}/*
83+
84+
%if %{with python3}
85+
%files -n python%{python3_pkgversion}-%{pkgname}
86+
%license LICENSE
87+
%{python3_sitelib}/*
88+
%endif
89+
90+
91+
%changelog
92+
* Mon Sep 30 2019 Croc Cloud Engineering - 0.4.0-1
93+
- Build for py2/py3 for Croc cloud
94+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
long_description = fh.read()
4747

4848
setup(
49-
name="jsonrpclib-pelix",
49+
name="jsonrpclib",
5050
version=__version__,
5151
license="Apache License 2.0",
5252
author="Thomas Calmant",

0 commit comments

Comments
 (0)