#7 Initial Python 3 Packaging
Merged 5 years ago by frantisekz. Opened 5 years ago by frantisekz.

file modified
+5 -3
@@ -28,8 +28,9 @@ 

  RELEASE:=$(subst $(DIST),,$(shell rpmspec -q --queryformat="%{RELEASE}\n" $(SPECFILE) | uniq))

  NVR:=python-$(SRC)-$(VERSION)-$(RELEASE)

  GITBRANCH:=$(shell git rev-parse --abbrev-ref HEAD)

- TARGETDIST:=fc27

- BUILDTARGET=fedora-27-x86_64

+ TARGETVER:=$(shell lsb_release -r |grep -o '[0-9]*')

+ TARGETDIST:=fc$(TARGETVER)

+ BUILDTARGET:=fedora-$(TARGETVER)-x86_64

  

  .PHONY: test

  test: $(VENV)
@@ -80,7 +81,8 @@ 

  .PHONY: mockbuild

  mockbuild: mocksrpm

  	mock -r $(BUILDTARGET) --no-clean --rebuild $(NVR).$(TARGETDIST).src.rpm

- 	cp /var/lib/mock/$(BUILDTARGET)/result/$(NVR).$(TARGETDIST).noarch.rpm .

+ 	cp /var/lib/mock/$(BUILDTARGET)/result/python2-resultsdb_api-$(VERSION)-$(RELEASE).$(TARGETDIST).noarch.rpm .

+ 	cp /var/lib/mock/$(BUILDTARGET)/result/python3-resultsdb_api-$(VERSION)-$(RELEASE).$(TARGETDIST).noarch.rpm .

  

  #.PHONY: kojibuild

  #kojibuild: mocksrpm

file modified
+13
@@ -2,6 +2,19 @@ 

  

  The ResultsDB API module provides a Python API for using ResultsDB's JSON/REST interface in a more pythonic way. It has functions which match the JSON/REST methods, but allow the common goodies as named parameters, and parameters skipping.

  

+ # Building ResultsDB API

+ 

+ You can use provided Makefile in order to build ResultsDB API. By default, it'll use buildroot equal to your current OS. You can override this behaviour by sepcifiyng variables for Make manually.

+ 

+ To build ResultsDB API:

+ `make mockbuild`

+ 

+ To build ResultsDB API for Fedora 27:

+ `make BUILDTARGET=fedora-27-x86_64 TARGETDIST=fc27 mocksrpm`

+ 

+ To build ResultsDB API for CentOS 7:

+ `make BUILDTARGET=epel-7-x86_64 TARGETDIST=el7 mocksrpm`

+ 

  # License

  

  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

file modified
+56 -27
@@ -1,7 +1,7 @@ 

  Name:           python-resultsdb_api

  # NOTE: if you update version, *make sure* to also update `setup.py`

  Version:        2.1.0

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        Interface api to ResultsDB

  

  License:        GPLv2+
@@ -11,28 +11,6 @@ 

  BuildArch:      noarch

  

  BuildRequires:  git

- BuildRequires:  python2-devel

- BuildRequires:  python2-pytest-cov

- BuildRequires:  python2-setuptools

- BuildRequires:  python2-simplejson

- 

- %if 0%{?fedora}

- BuildRequires:  python2-pytest

- BuildRequires:  python2-requests

- BuildRequires:  python2-virtualenv

- %else

- BuildRequires:  pytest

- BuildRequires:  python-requests

- BuildRequires:  python-virtualenv

- %endif

- 

- %if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?epel} && 0%{?epel} <= 7)

- BuildRequires:  python-dingus

- %else

- BuildRequires:  python2-dingus

- %endif

- 

- %{?python_provide:%python_provide python-resultsdb_api}

  

  %global _description\

  Interface api to ResultsDB
@@ -51,12 +29,45 @@ 

  Requires:       python-requests

  %endif

  

- %{?python_provide:%python_provide python2-resultsdb_api}

+ BuildRequires:  python2-devel

+ BuildRequires:  python2-pytest-cov

+ BuildRequires:  python2-setuptools

+ BuildRequires:  python2-simplejson

+ 

+ %if 0%{?fedora}

+ BuildRequires:  python2-pytest

+ BuildRequires:  python2-requests

+ BuildRequires:  python2-virtualenv

+ %else

+ BuildRequires:  pytest

+ BuildRequires:  python-requests

+ BuildRequires:  python-virtualenv

+ %endif

  

  %description -n python2-resultsdb_api %_description

  

  # *************************************

  

+ 

+ %if 0%{?fedora}

+ # ********* Python 3 package **********

+ %package -n python3-resultsdb_api

+ Summary: %summary

+ Requires:       python3-simplejson

+ Requires:       python3-requests

+ 

+ BuildRequires:  python3-devel

+ BuildRequires:  python3-pytest-cov

+ BuildRequires:  python3-setuptools

+ BuildRequires:  python3-simplejson

+ BuildRequires:  python3-pytest

+ BuildRequires:  python3-requests

+ BuildRequires:  python3-virtualenv

+ 

+ %description -n python3-resultsdb_api %_description

+ # *************************************

+ %endif

+ 

  %prep

  %setup -q -n resultsdb_api-%{version}

  
@@ -66,10 +77,16 @@ 

  # make test

  

  %build

- %{__python2} setup.py build

+ %py2_build

+ %if 0%{?fedora}

+ %py3_build

+ %endif

  

  %install

- %{__python2} setup.py install --skip-build --root %{buildroot}

+ %py2_install

+ %if 0%{?fedora}

+ %py3_install

+ %endif

  

  %files -n python2-resultsdb_api

  %doc README.md
@@ -77,11 +94,23 @@ 

  %{python2_sitelib}/resultsdb_api.*

  %{python2_sitelib}/*.egg-info

  

+ %if 0%{?fedora}

+ %files -n python3-resultsdb_api

+ %doc README.md

+ %license LICENSE

+ %{python3_sitelib}/resultsdb_api.*

+ %{python3_sitelib}/__pycache__/resultsdb_api.*

+ %{python3_sitelib}/*.egg-info

+ %endif

+ 

  %changelog

+ * Thu May 31 2018 Frantisek Zatloukal <fzatlouk@redhat.com> - 2.1.0-2

+ - Python 3 subpacakage for Fedora

+ 

  * Wed Mar 28 2018 Frantisek Zatloukal <fzatlouk@redhat.com> - 2.1.0-1

  - Add support for auth token

  - Retry on HTTP 500 errors by default

- - py3: Updates to work with Python 3 

+ - py3: Updates to work with Python 3

  

  * Mon Feb 19 2018 Steve Milner <smilner@redhat.com> - 2.0.1-1

  - Added six to support py2/py3 changes in the source.

TODO: CentOS 7 build doesn't work for now

rebased onto 96828b8

5 years ago

Building on CentOS 7 fixed:
- On Fedora, python2-resultsdb_api and python3-resultsdb_api will be built.
- On CentOS 7, only python2-resultsdb_api will be built.

Ready for review :)

Needs to have :=. Please add a short note into readme how to build for a specific fedora release, or for epel. Thanks.

rebased onto 4ff1891

5 years ago

Pull-Request has been merged by frantisekz

5 years ago