diff --git a/pygit2/__init__.py b/pygit2/__init__.py new file mode 100644 index 0000000..cd219c8 --- /dev/null +++ b/pygit2/__init__.py @@ -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 diff --git a/pygit2/utils.py b/pygit2/utils.py new file mode 100644 index 0000000..8ebf533 --- /dev/null +++ b/pygit2/utils.py @@ -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 diff --git a/setup.py b/setup.py index 9a6db31..bc6bb77 100644 --- a/setup.py +++ b/setup.py @@ -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']), diff --git a/src/pygit2.c b/src/pygit2.c index 2f7fe0b..fe46316 100644 --- a/src/pygit2.c +++ b/src/pygit2.c @@ -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); diff --git a/src/pygit2/blob.c b/src/pygit2/blob.c index f4ac8f4..4b78199 100644 --- a/src/pygit2/blob.c +++ b/src/pygit2/blob.c @@ -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 */ diff --git a/src/pygit2/commit.c b/src/pygit2/commit.c index de4c110..d555189 100644 --- a/src/pygit2/commit.c +++ b/src/pygit2/commit.c @@ -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 */ diff --git a/src/pygit2/index.c b/src/pygit2/index.c index 256b778..475d04c 100644 --- a/src/pygit2/index.c +++ b/src/pygit2/index.c @@ -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 */ diff --git a/src/pygit2/object.c b/src/pygit2/object.c index 44a0d76..62a5182 100644 --- a/src/pygit2/object.c +++ b/src/pygit2/object.c @@ -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 */ diff --git a/src/pygit2/reference.c b/src/pygit2/reference.c index 9ce78aa..f1a076d 100644 --- a/src/pygit2/reference.c +++ b/src/pygit2/reference.c @@ -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 */ diff --git a/src/pygit2/repository.c b/src/pygit2/repository.c index 65c8628..a06e5f1 100644 --- a/src/pygit2/repository.c +++ b/src/pygit2/repository.c @@ -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 */ diff --git a/src/pygit2/signature.c b/src/pygit2/signature.c index e750c82..cc4f8c2 100644 --- a/src/pygit2/signature.c +++ b/src/pygit2/signature.c @@ -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 */ diff --git a/src/pygit2/tag.c b/src/pygit2/tag.c index b1536e2..ab4a2b5 100644 --- a/src/pygit2/tag.c +++ b/src/pygit2/tag.c @@ -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 */ diff --git a/src/pygit2/tree.c b/src/pygit2/tree.c index 0445aa1..436b3f9 100644 --- a/src/pygit2/tree.c +++ b/src/pygit2/tree.c @@ -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 */ diff --git a/src/pygit2/walker.c b/src/pygit2/walker.c index 36db770..7b785da 100644 --- a/src/pygit2/walker.c +++ b/src/pygit2/walker.c @@ -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 */