2

I want to use pygit2's libgit2 bindings inside a Sublime Text plugin.

Q: Is it possible to embed a functional version of pygit2 and libgit2 that ST can import for both Windows 32bit/64bit and Debian 32bit/64bit?

Q: Is a python virtualenv something I should be using?

Current state of attempts: (OS Linux Mint 16)

  • Installed pygit as per these *nix instructions: http://www.pygit2.org/install.html Substituting python2.x tools with python 3.x tools.
  • Copied Recursive /usr/local/lib/python3.3/dist-packages/pygit2/ folder to ~/.config/sublime-text-3/Packages/ugit/pygit2/
  • Copied /usr/local/lib/libgit2.so* files to ~/.config/sublime-text-3/Packages/ugit/libgit2/*

Attempting to import pygit2:

ugit.py

import sublime, sublime_plugin
import ugit.pygit2

class ExampleCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.insert(edit, 0, "Hello, World!")

Results in import _pygit2 ImportError: No module named '_pygit2'

Attempting to import libgit2.so

ugit.py

import sublime, sublime_plugin
import ugit.libgit.libgit2.so
# import ugit.pygit2

class ExampleCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.insert(edit, 0, "Hello, World!")

Results in ImportError: dynamic module does not define init function (PyInit_libgit2)

May be there are some concepts I'm missing here, Don't be afraid to phrase things like I'm five.

ThorSummoner
  • 16,657
  • 15
  • 135
  • 147

0 Answers0