From 6a980269667719d3f399c61ce50e16194da02d33 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Oct 09 2015 10:16:15 +0000 Subject: [PATCH 1/2] Update README.rst with instructions for virtualenv. --- diff --git a/README.rst b/README.rst index 236972b..fbbeaeb 100644 --- a/README.rst +++ b/README.rst @@ -26,6 +26,20 @@ Get it running * Retrieve the sources:: git clone git://github.com/pypingou/pagure + cd pagure + + +* Install dependencies + + * development virtualenv:: + + dnf install libgit2-devel + virtualenv devel + devel/bin/pip install -r requirements.txt + + * Fedora RPMs:: + + dnf install $(cat requirements-fedora.txt) * Create the folder that will receive the projects, forks, docs and tickets' @@ -36,19 +50,26 @@ Get it running * Create the inital database scheme:: + # development virtualenv only + source devel/bin/activate + python createdb.py * Run it:: + # development virtualenv only + source devel/bin/activate + ./runserver.py * To get some profiling information you can also run it as:: - ./runserver.py --profile + # development virtualenv only + source devel/bin/activate + ./runserver.py --profile This will launch the application at http://127.0.0.1:5000 - diff --git a/requirements-fedora.txt b/requirements-fedora.txt new file mode 100644 index 0000000..6543eb7 --- /dev/null +++ b/requirements-fedora.txt @@ -0,0 +1,11 @@ +python-arrow +python-bleach +python-flask +python-flask-wtf +python-jinja2 +python-markdown +python-openid-cla +python-openid-teams +python-redis +python-sqlalchemy +python-straight-plugin From f92a991468a2cc0dcf4892b7dba409f5fd91f82e Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Oct 09 2015 10:20:40 +0000 Subject: [PATCH 2/2] Fix pygit2 version comparison for pygit2 >= 0.23. --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 1a9726c..cdc9c5b 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -32,6 +32,13 @@ from pagure.lib.repo import PagureRepo # pylint: disable=R0913,E1101,R0914 +def get_pygit2_version(): + ''' Return pygit2 version as a tuple of integers. + This is needed for correct version comparison. + ''' + return tuple([int(i) for i in pygit2.__version__.split('.')]) + + def commit_to_patch(repo_obj, commits): ''' For a given commit (PyGit2 commit object) of a specified git repo, returns a string representation of the changes the commit did in a diff --git a/pagure/lib/repo.py b/pagure/lib/repo.py index c8a0661..2db6ba5 100644 --- a/pagure/lib/repo.py +++ b/pagure/lib/repo.py @@ -13,6 +13,7 @@ import pygit2 import pagure import pagure.exceptions +import pagure.lib.git class PagureRepo(pygit2.Repository): @@ -24,7 +25,8 @@ class PagureRepo(pygit2.Repository): @staticmethod def push(remote, refname): """ Push the given reference to the specified remote. """ - if pygit2.__version__.startswith('0.22'): + pygit2_version = pagure.lib.git.get_pygit2_version() + if pygit2_version >= (0, 22): remote.push([refname]) else: remote.push(refname)