added pygit2.utils module
refactored package integration to be able to have pygit2.utils module
This commit is contained in:
29
pygit2/__init__.py
Normal file
29
pygit2/__init__.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright 2012 Nico von Geyso
|
||||||
|
#
|
||||||
|
# This file is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License, version 2,
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# In addition to the permissions in the GNU General Public License,
|
||||||
|
# the authors give you unlimited permission to link the compiled
|
||||||
|
# version of this file into combinations with other programs,
|
||||||
|
# and to distribute those combinations without any restriction
|
||||||
|
# coming from the use of this file. (The General Public License
|
||||||
|
# restrictions do apply in other respects; for example, they cover
|
||||||
|
# modification of the file, and distribution when not linked into
|
||||||
|
# a combined executable.)
|
||||||
|
#
|
||||||
|
# This file 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; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
from _pygit2 import *
|
||||||
|
import pygit2.utils
|
29
pygit2/utils.py
Normal file
29
pygit2/utils.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright 2012 Nico von Geyso
|
||||||
|
#
|
||||||
|
# This file is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License, version 2,
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# In addition to the permissions in the GNU General Public License,
|
||||||
|
# the authors give you unlimited permission to link the compiled
|
||||||
|
# version of this file into combinations with other programs,
|
||||||
|
# and to distribute those combinations without any restriction
|
||||||
|
# coming from the use of this file. (The General Public License
|
||||||
|
# restrictions do apply in other respects; for example, they cover
|
||||||
|
# modification of the file, and distribution when not linked into
|
||||||
|
# a combined executable.)
|
||||||
|
#
|
||||||
|
# This file 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; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
# feel free to add utils functions here
|
3
setup.py
3
setup.py
@@ -142,8 +142,9 @@ setup(name='pygit2',
|
|||||||
maintainer='J. David Ibáñez',
|
maintainer='J. David Ibáñez',
|
||||||
maintainer_email='jdavid.ibp@gmail.com',
|
maintainer_email='jdavid.ibp@gmail.com',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
package = ['pygit2'],
|
||||||
ext_modules=[
|
ext_modules=[
|
||||||
Extension('pygit2', pygit2_exts,
|
Extension('_pygit2', pygit2_exts,
|
||||||
include_dirs=[libgit2_include, 'include'],
|
include_dirs=[libgit2_include, 'include'],
|
||||||
library_dirs=[libgit2_lib],
|
library_dirs=[libgit2_lib],
|
||||||
libraries=['git2']),
|
libraries=['git2']),
|
||||||
|
10
src/pygit2.c
10
src/pygit2.c
@@ -116,7 +116,7 @@ moduleinit(PyObject* m)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GitError = PyErr_NewException("pygit2.GitError", NULL, NULL);
|
GitError = PyErr_NewException("_pygit2.GitError", NULL, NULL);
|
||||||
|
|
||||||
RepositoryType.tp_new = PyType_GenericNew;
|
RepositoryType.tp_new = PyType_GenericNew;
|
||||||
if (PyType_Ready(&RepositoryType) < 0)
|
if (PyType_Ready(&RepositoryType) < 0)
|
||||||
@@ -231,17 +231,17 @@ moduleinit(PyObject* m)
|
|||||||
|
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
initpygit2(void)
|
init_pygit2(void)
|
||||||
{
|
{
|
||||||
PyObject* m;
|
PyObject* m;
|
||||||
m = Py_InitModule3("pygit2", module_methods,
|
m = Py_InitModule3("_pygit2", module_methods,
|
||||||
"Python bindings for libgit2.");
|
"Python bindings for libgit2.");
|
||||||
moduleinit(m);
|
moduleinit(m);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
struct PyModuleDef moduledef = {
|
struct PyModuleDef moduledef = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"pygit2", /* m_name */
|
"_pygit2", /* m_name */
|
||||||
"Python bindings for libgit2.", /* m_doc */
|
"Python bindings for libgit2.", /* m_doc */
|
||||||
-1, /* m_size */
|
-1, /* m_size */
|
||||||
module_methods, /* m_methods */
|
module_methods, /* m_methods */
|
||||||
@@ -252,7 +252,7 @@ moduleinit(PyObject* m)
|
|||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
PyInit_pygit2(void)
|
PyInit__pygit2(void)
|
||||||
{
|
{
|
||||||
PyObject* m;
|
PyObject* m;
|
||||||
m = PyModule_Create(&moduledef);
|
m = PyModule_Create(&moduledef);
|
||||||
|
@@ -8,7 +8,7 @@ PyGetSetDef Blob_getseters[] = {
|
|||||||
|
|
||||||
PyTypeObject BlobType = {
|
PyTypeObject BlobType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Blob", /* tp_name */
|
"_pygit2.Blob", /* tp_name */
|
||||||
sizeof(Blob), /* tp_basicsize */
|
sizeof(Blob), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
0, /* tp_dealloc */
|
0, /* tp_dealloc */
|
||||||
|
@@ -146,7 +146,7 @@ PyGetSetDef Commit_getseters[] = {
|
|||||||
|
|
||||||
PyTypeObject CommitType = {
|
PyTypeObject CommitType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Commit", /* tp_name */
|
"_pygit2.Commit", /* tp_name */
|
||||||
sizeof(Commit), /* tp_basicsize */
|
sizeof(Commit), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
0, /* tp_dealloc */
|
0, /* tp_dealloc */
|
||||||
|
@@ -319,7 +319,7 @@ PyMappingMethods Index_as_mapping = {
|
|||||||
|
|
||||||
PyTypeObject IndexType = {
|
PyTypeObject IndexType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Index", /* tp_name */
|
"_pygit2.Index", /* tp_name */
|
||||||
sizeof(Index), /* tp_basicsize */
|
sizeof(Index), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Index_dealloc, /* tp_dealloc */
|
(destructor)Index_dealloc, /* tp_dealloc */
|
||||||
@@ -383,7 +383,7 @@ IndexIter_iternext(IndexIter *self)
|
|||||||
|
|
||||||
PyTypeObject IndexIterType = {
|
PyTypeObject IndexIterType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.IndexIter", /* tp_name */
|
"_pygit2.IndexIter", /* tp_name */
|
||||||
sizeof(IndexIter), /* tp_basicsize */
|
sizeof(IndexIter), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)IndexIter_dealloc , /* tp_dealloc */
|
(destructor)IndexIter_dealloc , /* tp_dealloc */
|
||||||
@@ -452,7 +452,7 @@ PyGetSetDef IndexEntry_getseters[] = {
|
|||||||
|
|
||||||
PyTypeObject IndexEntryType = {
|
PyTypeObject IndexEntryType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.IndexEntry", /* tp_name */
|
"_pygit2.IndexEntry", /* tp_name */
|
||||||
sizeof(IndexEntry), /* tp_basicsize */
|
sizeof(IndexEntry), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)IndexEntry_dealloc, /* tp_dealloc */
|
(destructor)IndexEntry_dealloc, /* tp_dealloc */
|
||||||
|
@@ -79,7 +79,7 @@ PyMethodDef Object_methods[] = {
|
|||||||
|
|
||||||
PyTypeObject ObjectType = {
|
PyTypeObject ObjectType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Object", /* tp_name */
|
"_pygit2.Object", /* tp_name */
|
||||||
sizeof(Object), /* tp_basicsize */
|
sizeof(Object), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Object_dealloc, /* tp_dealloc */
|
(destructor)Object_dealloc, /* tp_dealloc */
|
||||||
|
@@ -247,7 +247,7 @@ PyGetSetDef Reference_getseters[] = {
|
|||||||
|
|
||||||
PyTypeObject ReferenceType = {
|
PyTypeObject ReferenceType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Reference", /* tp_name */
|
"_pygit2.Reference", /* tp_name */
|
||||||
sizeof(Reference), /* tp_basicsize */
|
sizeof(Reference), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Reference_dealloc, /* tp_dealloc */
|
(destructor)Reference_dealloc, /* tp_dealloc */
|
||||||
|
@@ -764,7 +764,7 @@ PyMappingMethods Repository_as_mapping = {
|
|||||||
|
|
||||||
PyTypeObject RepositoryType = {
|
PyTypeObject RepositoryType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Repository", /* tp_name */
|
"_pygit2.Repository", /* tp_name */
|
||||||
sizeof(Repository), /* tp_basicsize */
|
sizeof(Repository), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Repository_dealloc, /* tp_dealloc */
|
(destructor)Repository_dealloc, /* tp_dealloc */
|
||||||
|
@@ -123,7 +123,7 @@ PyGetSetDef Signature_getseters[] = {
|
|||||||
|
|
||||||
PyTypeObject SignatureType = {
|
PyTypeObject SignatureType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Signature", /* tp_name */
|
"_pygit2.Signature", /* tp_name */
|
||||||
sizeof(Signature), /* tp_basicsize */
|
sizeof(Signature), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Signature_dealloc, /* tp_dealloc */
|
(destructor)Signature_dealloc, /* tp_dealloc */
|
||||||
|
@@ -62,7 +62,7 @@ PyGetSetDef Tag_getseters[] = {
|
|||||||
|
|
||||||
PyTypeObject TagType = {
|
PyTypeObject TagType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Tag", /* tp_name */
|
"_pygit2.Tag", /* tp_name */
|
||||||
sizeof(Tag), /* tp_basicsize */
|
sizeof(Tag), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
0, /* tp_dealloc */
|
0, /* tp_dealloc */
|
||||||
|
@@ -69,7 +69,7 @@ PyMethodDef TreeEntry_methods[] = {
|
|||||||
|
|
||||||
PyTypeObject TreeEntryType = {
|
PyTypeObject TreeEntryType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.TreeEntry", /* tp_name */
|
"_pygit2.TreeEntry", /* tp_name */
|
||||||
sizeof(TreeEntry), /* tp_basicsize */
|
sizeof(TreeEntry), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)TreeEntry_dealloc, /* tp_dealloc */
|
(destructor)TreeEntry_dealloc, /* tp_dealloc */
|
||||||
@@ -245,7 +245,7 @@ PyMappingMethods Tree_as_mapping = {
|
|||||||
|
|
||||||
PyTypeObject TreeType = {
|
PyTypeObject TreeType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Tree", /* tp_name */
|
"_pygit2.Tree", /* tp_name */
|
||||||
sizeof(Tree), /* tp_basicsize */
|
sizeof(Tree), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
0, /* tp_dealloc */
|
0, /* tp_dealloc */
|
||||||
@@ -371,7 +371,7 @@ PyMethodDef TreeBuilder_methods[] = {
|
|||||||
|
|
||||||
PyTypeObject TreeBuilderType = {
|
PyTypeObject TreeBuilderType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.TreeBuilder", /* tp_name */
|
"_pygit2.TreeBuilder", /* tp_name */
|
||||||
sizeof(TreeBuilder), /* tp_basicsize */
|
sizeof(TreeBuilder), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)TreeBuilder_dealloc, /* tp_dealloc */
|
(destructor)TreeBuilder_dealloc, /* tp_dealloc */
|
||||||
@@ -432,7 +432,7 @@ TreeIter_iternext(TreeIter *self)
|
|||||||
|
|
||||||
PyTypeObject TreeIterType = {
|
PyTypeObject TreeIterType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.TreeIter", /* tp_name */
|
"_pygit2.TreeIter", /* tp_name */
|
||||||
sizeof(TreeIter), /* tp_basicsize */
|
sizeof(TreeIter), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)TreeIter_dealloc , /* tp_dealloc */
|
(destructor)TreeIter_dealloc , /* tp_dealloc */
|
||||||
|
@@ -117,7 +117,7 @@ PyMethodDef Walker_methods[] = {
|
|||||||
|
|
||||||
PyTypeObject WalkerType = {
|
PyTypeObject WalkerType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"pygit2.Walker", /* tp_name */
|
"_pygit2.Walker", /* tp_name */
|
||||||
sizeof(Walker), /* tp_basicsize */
|
sizeof(Walker), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)Walker_dealloc, /* tp_dealloc */
|
(destructor)Walker_dealloc, /* tp_dealloc */
|
||||||
|
Reference in New Issue
Block a user