1
0
forked from pool/python-pygit2
Sascha Peilicke 2011-02-02 12:49:39 +00:00 committed by Git OBS Bridge
commit d281e2cab7
6 changed files with 224 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,111 @@
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;
}

3
pygit2-0.1.tar.bz2 Normal file
View File

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

17
python-pygit2.changes Normal file
View File

@ -0,0 +1,17 @@
-------------------------------------------------------------------
Wed Jan 26 17:26:21 UTC 2011 - saschpe@gmx.de
- Removed SUSE-specific --record-rpm for file lists
-------------------------------------------------------------------
Tue Jan 18 21:49:47 UTC 2011 - saschpe@gmx.de
- Install documentation (README.md and COPYING)
- Fix install section for other distros
-------------------------------------------------------------------
Tue Jan 18 20:48:40 UTC 2011 - saschpe@gmx.de
- Initial commit (0.1)
- Added patch include recent libgit2 changes

69
python-pygit2.spec Normal file
View File

@ -0,0 +1,69 @@
#
# spec file for package python-pygit2
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# 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-%{mod_name}
Version: 0.1
Release: 0
Url: http://github.com/dborowitz/pygit2
Summary: Python bindings for libgit2
License: Apache 2.0
Group: Development/Languages/Python
Source: %{mod_name}-%{version}.tar.bz2
Patch0: %{mod_name}-%{version}-libgit2-updates.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel libgit2-devel
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: openssl-devel
%else
BuildRequires: libopenssl-devel
%endif
%if 0%{?suse_version}
%py_requires
%endif
%description
Bindings for libgit2, a linkable C library for the Git version-control system.
%prep
export CFLAGS="%{optflags}"
%setup -n %{mod_name}
%patch0 -p1
# Adjust include/lib paths to local system
sed -i 's|/usr/local/include|%{_includedir}|' setup.py
sed -i 's|/usr/local/lib|%{_libdir}|' setup.py
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README.md COPYING
%python_sitearch/%{mod_name}*
%changelog