From 4861ee2ef75fd34b718a57712283d579cf91245c Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: May 28 2018 12:44:56 +0000 Subject: [PATCH 1/3] doit: update dodo.py to work with Python 3 This allows the doit commands to be executed with system doit using python3 (or from venv if you prefer, but doit with py2 support is available only in an old version). All commands should work without venv active, simplifying build process, except builddocs - that requires venv active. It is be possible to automatically create venv for builddocs and use it, but it would require more extensive patches. --- diff --git a/docs/source/devguide.rst b/docs/source/devguide.rst index 6ce115d..8ec8d61 100644 --- a/docs/source/devguide.rst +++ b/docs/source/devguide.rst @@ -43,6 +43,7 @@ On your Fedora system, install the necessary packages:: gcc \ git \ libtaskotron-config \ + python3-doit \ python2-hawkey \ python3-hawkey \ python2-koji \ diff --git a/dodo.py b/dodo.py index e2ab324..ef37f3e 100644 --- a/dodo.py +++ b/dodo.py @@ -24,7 +24,7 @@ TARGETDIST = '.fc27' BUILDARCH = 'noarch' COPRREPOS = ['https://copr-be.cloud.fedoraproject.org/results/kparal/taskotron-dev/fedora-27-x86_64/'] # virtualenv name to use for operations which require it -VENVNAME = 'env_testing' +VENVNAME = 'env_doit' # These are deps needed in a virtualenv which are not on pypi VENV_GIT_REPOS = [] @@ -58,7 +58,8 @@ def get_rpmrelease(specfile, disttag=TARGETDIST): '--specfile', specfile, '--queryformat=%{RELEASE}\\n', '--define', 'dist %s' % disttag] - output = subprocess.check_output(command).split()[0].strip() + output = subprocess.check_output(command) + output = output.decode('utf-8').split()[0].strip() return output @@ -77,8 +78,9 @@ def get_gitbranch(): """retrieve the current git branch""" gitbranch_command = ['git', 'rev-parse', '--abbrev-ref', 'HEAD'] - raw_output = subprocess.check_output(gitbranch_command) - return raw_output.strip() + output = subprocess.check_output(gitbranch_command) + output = output.decode('utf-8').strip() + return output def maybe_use_virtualenv(commands): @@ -277,8 +279,7 @@ def task_updatelatest(): def task_test(): """Run the unit and functional tests""" - return {'actions': maybe_use_virtualenv(['py.test']), - 'task_dep': ['_checkvirtualenv'] + return {'actions': ['tox'], } diff --git a/requirements.txt b/requirements.txt index 0da99c5..bf7a428 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,6 +29,3 @@ pytest-cov >= 2.2.1 # Documentation requirements Sphinx >= 1.2.3 sphinx_rtd_theme >= 0.1.9 - -# Build requirements -doit == 0.29.0 # the last doit with python2 support From fb3a63c9fc1fca7008eb80a1f9ddf5a6fbd73f0a Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: May 28 2018 12:45:30 +0000 Subject: [PATCH 2/3] remove Makefile It was recently added, but we don't want to have 2 different build scripts with a different level of support. --- diff --git a/Makefile b/Makefile deleted file mode 100644 index 77bc8b8..0000000 --- a/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -# -# Copyright 2018, Red Hat, Inc. -# -# 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -# general variables -SRC:=libtaskotron - -# Variables used for packaging -SPECFILE:=$(SRC).spec -BASEARCH:=$(shell uname -i) -DIST:=$(shell rpm --eval '%{dist}') -VERSION:=$(shell rpmspec -q --queryformat="%{VERSION}\n" $(SPECFILE) | uniq) -RELEASE:=$(subst $(DIST),,$(shell rpmspec -q --queryformat="%{RELEASE}\n" $(SPECFILE) | uniq)) -NVR:=$(SRC)-$(VERSION)-$(RELEASE) -GITBRANCH:=$(shell git rev-parse --abbrev-ref HEAD) -TARGETVER:=$(shell lsb_release -r |grep -o '[0-9]*') -TARGETDIST:=fc$(TARGETVER) -BUILDTARGET:=fedora-$(TARGETVER)-x86_64 - -.PHONY: pylint -pylint: - pylint -f parseable $(SRC) | tee pylint.out - -.PHONY: pep8 -pep8: - pep8 $(SRC)/*.py $(SRC)/*/*.py | tee pep8.out - -.PHONY: ci -ci: pylint pep8 - -.PHONY: docs -docs: - cd docs && $(MAKE) clean && $(MAKE) html - -.PHONY: clean -clean: - rm -rf dist - rm -rf $(SRC).egg-info - rm -rf build - rm -f pep8.out - rm -f pylint.out - -.PHONY: archive -archive: $(SRC)-$(VERSION).tar.gz - -.PHONY: $(SRC)-$(VERSION).tar.gz -$(SRC)-$(VERSION).tar.gz: - git archive $(GITBRANCH) --prefix=$(SRC)-$(VERSION)/ | gzip -c9 > $@ - -.PHONY: mocksrpm -mocksrpm: archive - mock -r $(BUILDTARGET) --buildsrpm --spec $(SPECFILE) --sources . - cp /var/lib/mock/$(BUILDTARGET)/result/$(NVR).$(TARGETDIST).src.rpm . - -.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/$(SRC)-config-$(VERSION)-$(RELEASE).$(TARGETDIST).noarch.rpm . - cp /var/lib/mock/$(BUILDTARGET)/result/$(SRC)-core-$(VERSION)-$(RELEASE).$(TARGETDIST).noarch.rpm . - cp /var/lib/mock/$(BUILDTARGET)/result/$(SRC)-disposable-$(VERSION)-$(RELEASE).$(TARGETDIST).noarch.rpm . - cp /var/lib/mock/$(BUILDTARGET)/result/$(SRC)-fedora-$(VERSION)-$(RELEASE).$(TARGETDIST).noarch.rpm . - -.PHONY: nvr -nvr: - @echo $(NVR) From 231d66f4617141567286a1556585ce496f0d778d Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: May 28 2018 13:07:11 +0000 Subject: [PATCH 3/3] devguide: install python3-progressbar from RPM Because progressbar from PyPI is currently broken for Python3. See https://stackoverflow.com/a/33063959 --- diff --git a/docs/source/devguide.rst b/docs/source/devguide.rst index 8ec8d61..1764e77 100644 --- a/docs/source/devguide.rst +++ b/docs/source/devguide.rst @@ -52,6 +52,7 @@ On your Fedora system, install the necessary packages:: python3-libvirt \ python2-pip \ python3-pip \ + python3-progressbar \ python2-rpm \ python3-rpm \ python2-rpmfluff \