1
0
forked from pool/python-pygit2
Sascha Peilicke 2011-12-09 12:10:44 +00:00 committed by Git OBS Bridge
parent d281e2cab7
commit 4e1e87afc7
4 changed files with 13 additions and 129 deletions

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:31803d2f042ca80b15a142067879fcb61fd35f445cb69fee882800e530702ed2
size 49881

View File

@ -1,111 +0,0 @@
diff --git a/pygit2.c b/pygit2.c
index 9dd5a4b..deae605 100644
--- a/pygit2.c
+++ b/pygit2.c
@@ -26,13 +26,8 @@
*/
#include <Python.h>
-#include <git/commit.h>
-#include <git/common.h>
-#include <git/errors.h>
-#include <git/repository.h>
-#include <git/commit.h>
-#include <git/odb.h>
-#include <git/tag.h>
+#include <git2.h>
+
typedef struct {
PyObject_HEAD
@@ -559,11 +554,11 @@ Commit_get_commit_time(Commit *commit) {
static PyObject *
Commit_get_committer(Commit *commit) {
- git_person *committer;
- committer = (git_person*)git_commit_committer(commit->commit);
- return build_person(git_person_name(committer),
- git_person_email(committer),
- git_person_time(committer));
+ const git_signature *committer = git_commit_committer(commit->commit);
+
+ return build_person(committer->name,
+ committer->email,
+ committer->when.time);
}
static int
@@ -572,17 +567,22 @@ Commit_set_committer(Commit *commit, PyObject *value) {
long long time;
if (!parse_person(value, &name, &email, &time))
return -1;
- git_commit_set_committer(commit->commit, name, email, time);
+
+ git_signature *signature = git_signature_new(name, email, time, 0);
+ if ( signature == NULL)
+ return -1;
+
+ git_commit_set_committer(commit->commit, signature);
return 0;
}
static PyObject *
Commit_get_author(Commit *commit) {
- git_person *author;
- author = (git_person*)git_commit_author(commit->commit);
- return build_person(git_person_name(author),
- git_person_email(author),
- git_person_time(author));
+ const git_signature *author = git_commit_author(commit->commit);
+
+ return build_person(author->name,
+ author->email,
+ author->when.time);
}
static int
@@ -591,7 +591,11 @@ Commit_set_author(Commit *commit, PyObject *value) {
long long time;
if (!parse_person(value, &name, &email, &time))
return -1;
- git_commit_set_author(commit->commit, name, email, time);
+ git_signature *signature = git_signature_new(name, email, time, 0);
+ if ( signature == NULL)
+ return -1;
+
+ git_commit_set_author(commit->commit, signature);
return 0;
}
@@ -1138,13 +1142,12 @@ Tag_set_name(Tag *self, PyObject *py_name) {
static PyObject *
Tag_get_tagger(Tag *tag) {
- git_person *tagger;
- tagger = (git_person*)git_tag_tagger(tag->tag);
+ const git_signature *tagger = git_tag_tagger(tag->tag);
if (!tagger)
Py_RETURN_NONE;
- return build_person(git_person_name(tagger),
- git_person_email(tagger),
- git_person_time(tagger));
+ return build_person(tagger->name,
+ tagger->email,
+ tagger->when.time);
}
static int
@@ -1153,7 +1156,12 @@ Tag_set_tagger(Tag *tag, PyObject *value) {
long long time;
if (!parse_person(value, &name, &email, &time))
return -1;
- git_tag_set_tagger(tag->tag, name, email, time);
+
+ git_signature *signature = git_signature_new(name, email, time, 0);
+ if ( signature == NULL)
+ return -1;
+
+ git_tag_set_tagger(tag->tag, signature);
return 0;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:337482703b1d8a3f90c6ac437c571368b8df62f02a04f117e9948034c9a9cd14
size 19176

View File

@ -15,23 +15,18 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
# norootforbuild
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%define mod_name pygit2 Name: python-pygit2
Name: python-%{mod_name}
Version: 0.1 Version: 0.1
Release: 0 Release: 0
Url: http://github.com/dborowitz/pygit2 Url: http://github.com/dborowitz/pygit2
Summary: Python bindings for libgit2 Summary: Python bindings for libgit2
License: Apache 2.0 License: Apache-2.0
Group: Development/Languages/Python Group: Development/Languages/Python
Source: %{mod_name}-%{version}.tar.bz2 Source: libgit2-pygit2-v0.15.0-0-g1dde686.tar.gz
Patch0: %{mod_name}-%{version}-libgit2-updates.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel libgit2-devel BuildRequires: libgit2-devel
BuildRequires: python-devel
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: openssl-devel BuildRequires: openssl-devel
%else %else
@ -40,14 +35,14 @@ BuildRequires: libopenssl-devel
%if 0%{?suse_version} %if 0%{?suse_version}
%py_requires %py_requires
%endif %endif
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%description %description
Bindings for libgit2, a linkable C library for the Git version-control system. Bindings for libgit2, a linkable C library for the Git version-control system.
%prep %prep
export CFLAGS="%{optflags}" export CFLAGS="%{optflags}"
%setup -n %{mod_name} %setup -n libgit2-pygit2-1dde686
%patch0 -p1
# Adjust include/lib paths to local system # Adjust include/lib paths to local system
sed -i 's|/usr/local/include|%{_includedir}|' setup.py sed -i 's|/usr/local/include|%{_includedir}|' setup.py
sed -i 's|/usr/local/lib|%{_libdir}|' setup.py sed -i 's|/usr/local/lib|%{_libdir}|' setup.py
@ -58,12 +53,12 @@ python setup.py build
%install %install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%clean #%%check
rm -rf %{buildroot} #python setup.py test
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README.md COPYING %doc README.md COPYING
%python_sitearch/%{mod_name}* %python_sitearch/pygit2*
%changelog %changelog