added pygit2.utils module

refactored package integration to be able to have pygit2.utils module
This commit is contained in:
Nico von Geyso
2012-05-25 14:23:25 +02:00
parent 6b1a281edc
commit ad4edf1b85
14 changed files with 80 additions and 21 deletions

29
pygit2/__init__.py Normal file
View 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
View 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

View File

@@ -142,8 +142,9 @@ setup(name='pygit2',
maintainer='J. David Ibáñez',
maintainer_email='jdavid.ibp@gmail.com',
long_description=long_description,
package = ['pygit2'],
ext_modules=[
Extension('pygit2', pygit2_exts,
Extension('_pygit2', pygit2_exts,
include_dirs=[libgit2_include, 'include'],
library_dirs=[libgit2_lib],
libraries=['git2']),

View File

@@ -116,7 +116,7 @@ moduleinit(PyObject* m)
if (m == NULL)
return NULL;
GitError = PyErr_NewException("pygit2.GitError", NULL, NULL);
GitError = PyErr_NewException("_pygit2.GitError", NULL, NULL);
RepositoryType.tp_new = PyType_GenericNew;
if (PyType_Ready(&RepositoryType) < 0)
@@ -231,17 +231,17 @@ moduleinit(PyObject* m)
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC
initpygit2(void)
init_pygit2(void)
{
PyObject* m;
m = Py_InitModule3("pygit2", module_methods,
m = Py_InitModule3("_pygit2", module_methods,
"Python bindings for libgit2.");
moduleinit(m);
}
#else
struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"pygit2", /* m_name */
"_pygit2", /* m_name */
"Python bindings for libgit2.", /* m_doc */
-1, /* m_size */
module_methods, /* m_methods */
@@ -252,7 +252,7 @@ moduleinit(PyObject* m)
};
PyMODINIT_FUNC
PyInit_pygit2(void)
PyInit__pygit2(void)
{
PyObject* m;
m = PyModule_Create(&moduledef);

View File

@@ -8,7 +8,7 @@ PyGetSetDef Blob_getseters[] = {
PyTypeObject BlobType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Blob", /* tp_name */
"_pygit2.Blob", /* tp_name */
sizeof(Blob), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */

View File

@@ -146,7 +146,7 @@ PyGetSetDef Commit_getseters[] = {
PyTypeObject CommitType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Commit", /* tp_name */
"_pygit2.Commit", /* tp_name */
sizeof(Commit), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */

View File

@@ -319,7 +319,7 @@ PyMappingMethods Index_as_mapping = {
PyTypeObject IndexType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Index", /* tp_name */
"_pygit2.Index", /* tp_name */
sizeof(Index), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Index_dealloc, /* tp_dealloc */
@@ -383,7 +383,7 @@ IndexIter_iternext(IndexIter *self)
PyTypeObject IndexIterType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.IndexIter", /* tp_name */
"_pygit2.IndexIter", /* tp_name */
sizeof(IndexIter), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)IndexIter_dealloc , /* tp_dealloc */
@@ -452,7 +452,7 @@ PyGetSetDef IndexEntry_getseters[] = {
PyTypeObject IndexEntryType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.IndexEntry", /* tp_name */
"_pygit2.IndexEntry", /* tp_name */
sizeof(IndexEntry), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)IndexEntry_dealloc, /* tp_dealloc */

View File

@@ -79,7 +79,7 @@ PyMethodDef Object_methods[] = {
PyTypeObject ObjectType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Object", /* tp_name */
"_pygit2.Object", /* tp_name */
sizeof(Object), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Object_dealloc, /* tp_dealloc */

View File

@@ -247,7 +247,7 @@ PyGetSetDef Reference_getseters[] = {
PyTypeObject ReferenceType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Reference", /* tp_name */
"_pygit2.Reference", /* tp_name */
sizeof(Reference), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Reference_dealloc, /* tp_dealloc */

View File

@@ -764,7 +764,7 @@ PyMappingMethods Repository_as_mapping = {
PyTypeObject RepositoryType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Repository", /* tp_name */
"_pygit2.Repository", /* tp_name */
sizeof(Repository), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Repository_dealloc, /* tp_dealloc */

View File

@@ -123,7 +123,7 @@ PyGetSetDef Signature_getseters[] = {
PyTypeObject SignatureType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Signature", /* tp_name */
"_pygit2.Signature", /* tp_name */
sizeof(Signature), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Signature_dealloc, /* tp_dealloc */

View File

@@ -62,7 +62,7 @@ PyGetSetDef Tag_getseters[] = {
PyTypeObject TagType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Tag", /* tp_name */
"_pygit2.Tag", /* tp_name */
sizeof(Tag), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */

View File

@@ -69,7 +69,7 @@ PyMethodDef TreeEntry_methods[] = {
PyTypeObject TreeEntryType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.TreeEntry", /* tp_name */
"_pygit2.TreeEntry", /* tp_name */
sizeof(TreeEntry), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)TreeEntry_dealloc, /* tp_dealloc */
@@ -245,7 +245,7 @@ PyMappingMethods Tree_as_mapping = {
PyTypeObject TreeType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Tree", /* tp_name */
"_pygit2.Tree", /* tp_name */
sizeof(Tree), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
@@ -371,7 +371,7 @@ PyMethodDef TreeBuilder_methods[] = {
PyTypeObject TreeBuilderType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.TreeBuilder", /* tp_name */
"_pygit2.TreeBuilder", /* tp_name */
sizeof(TreeBuilder), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)TreeBuilder_dealloc, /* tp_dealloc */
@@ -432,7 +432,7 @@ TreeIter_iternext(TreeIter *self)
PyTypeObject TreeIterType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.TreeIter", /* tp_name */
"_pygit2.TreeIter", /* tp_name */
sizeof(TreeIter), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)TreeIter_dealloc , /* tp_dealloc */

View File

@@ -117,7 +117,7 @@ PyMethodDef Walker_methods[] = {
PyTypeObject WalkerType = {
PyVarObject_HEAD_INIT(NULL, 0)
"pygit2.Walker", /* tp_name */
"_pygit2.Walker", /* tp_name */
sizeof(Walker), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Walker_dealloc, /* tp_dealloc */