#416 doit: update dodo.py to work with Python 3
Merged 5 years ago by kparal. Opened 5 years ago by kparal.

file removed
-80
@@ -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)

@@ -43,6 +43,7 @@ 

    gcc                    \

    git                    \

    libtaskotron-config    \

+   python3-doit           \

    python2-hawkey         \

    python3-hawkey         \

    python2-koji           \
@@ -51,6 +52,7 @@ 

    python3-libvirt        \

    python2-pip            \

    python3-pip            \

+   python3-progressbar    \

    python2-rpm            \

    python3-rpm            \

    python2-rpmfluff       \

file modified
+7 -6
@@ -24,7 +24,7 @@ 

  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 @@ 

                 '--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 @@ 

      """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_test():

      """Run the unit and functional tests"""

-     return {'actions': maybe_use_virtualenv(['py.test']),

-             'task_dep': ['_checkvirtualenv']

+     return {'actions': ['tox'],

              }

  

  

file modified
-3
@@ -29,6 +29,3 @@ 

  # Documentation requirements

  Sphinx >= 1.2.3

  sphinx_rtd_theme >= 0.1.9

- 

- # Build requirements

- doit == 0.29.0  # the last doit with python2 support

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.

1 new commit added

  • devguide: install python3-progressbar from RPM
5 years ago

BTW, why exactly are we usig doit instead of Makefile in libtaskotron (all our other projects use Makefile IMO)?
Looking at the code it seems to be just a more complicated version of Makefile, with the added general akwardness of running shell-scripts from Python.

Not that I care at all what we use (Makefile vs doit), just curious to what the actual benefits over Makefile (de-factor standard) are.

Python 3 support looks/works just fine.

Removing the Makefile... seems bit unrelated.

BTW, why exactly are we usig doit instead of Makefile in libtaskotron (all our other projects use Makefile IMO)?
Looking at the code it seems to be just a more complicated version of Makefile, with the added general akwardness of running shell-scripts from Python.

That question would be best directed at @tflink. I personally don't care, doit is easier to maintain (it's python and I never remember makefile syntax), Makefile is more common.

Not that I care at all what we use (Makefile vs doit), just curious to what the actual benefits over Makefile (de-factor standard) are.

Me neither. I only strongly object to having 2 build scripts simultaneously, that's why I revert the recent undiscussed addition of Makefile. If anyone wants to replace doit with Makefile, feel free to submit PR, but please replace it, do not just add it. That means the new Makefile should retain the existing doit functionality (all build targets), unless some of them are not needed anymore (perhaps some of the CI stuff? please ask @tflink).

I assume everything's been cleared up, merging.

Commit 79f6168 fixes this pull-request

Pull-Request has been merged by kparal

5 years ago