コード例 #1
0
ファイル: _run.py プロジェクト: PKRoma/pygit2
    'repository.h',
    'revert.h',
    'stash.h',
    'submodule.h',
]
h_source = []
for h_file in h_files:
    h_file = os.path.join(dir_path, 'decl', h_file)
    with codecs.open(h_file, 'r', 'utf-8') as f:
        h_source.append(f.read())

C_HEADER_SRC = '\n'.join(h_source)

# Preamble
preamble = "#include <git2.h>"

# C_KEYWORDS
libgit2_bin, libgit2_include, libgit2_lib = get_libgit2_paths()
C_KEYWORDS = dict(libraries=['git2'],
                  library_dirs=[libgit2_lib],
                  include_dirs=[libgit2_include])

# ffi
ffi = FFI()
ffi.set_source("pygit2._libgit2", preamble, **C_KEYWORDS)
ffi.cdef(C_HEADER_SRC)


if __name__ == '__main__':
    ffi.compile()
コード例 #2
0
import codecs
from distutils.command.build import build
from distutils.command.sdist import sdist
from distutils import log
import os
from os import getenv, listdir, pathsep
from os.path import abspath, isfile
from subprocess import Popen, PIPE
import sys

# Import stuff from pygit2/_utils.py without loading the whole pygit2 package
sys.path.insert(0, 'pygit2')
from _build import __version__, get_libgit2_paths
del sys.path[0]

libgit2_bin, libgit2_kw = get_libgit2_paths()

pygit2_exts = [
    os.path.join('src', name) for name in sorted(listdir('src'))
    if name.endswith('.c')
]


class sdist_files_from_git(sdist):
    def get_file_list(self):
        popen = Popen(['git', 'ls-files'],
                      stdout=PIPE,
                      stderr=PIPE,
                      universal_newlines=True)
        stdoutdata, stderrdata = popen.communicate()
        if popen.returncode != 0:
コード例 #3
0
ファイル: _run.py プロジェクト: dcecile/pygit2
    'refspec.h',
    'repository.h',
    'revert.h',
    'stash.h',
    'submodule.h',
]
h_source = []
for h_file in h_files:
    h_file = os.path.join(dir_path, 'decl', h_file)
    with codecs.open(h_file, 'r', 'utf-8') as f:
        h_source.append(f.read())

C_HEADER_SRC = '\n'.join(h_source)

# Preamble
preamble = "#include <git2.h>"

# C_KEYWORDS
libgit2_bin, libgit2_include, libgit2_lib = get_libgit2_paths()
C_KEYWORDS = dict(libraries=['git2'],
                  library_dirs=[libgit2_lib],
                  include_dirs=[libgit2_include])

# ffi
ffi = FFI()
ffi.set_source("pygit2._libgit2", preamble, **C_KEYWORDS)
ffi.cdef(C_HEADER_SRC)

if __name__ == '__main__':
    ffi.compile()
コード例 #4
0
    'graph.h',
    'index.h',
    'merge.h',
    'net.h',
    'refspec.h',
    'repository.h',
    'revert.h',
    'stash.h',
    'submodule.h',
    'callbacks.h',  # Bridge from libgit2 to Python
]
h_source = []
for h_file in h_files:
    h_file = os.path.join(dir_path, 'decl', h_file)
    with codecs.open(h_file, 'r', 'utf-8') as f:
        h_source.append(f.read())

C_HEADER_SRC = '\n'.join(h_source)

# ffi
_, libgit2_kw = get_libgit2_paths()
ffi = FFI()
ffi.set_source(
    "pygit2._libgit2",
    "#include <git2.h>",  # preamble
    **libgit2_kw)
ffi.cdef(C_HEADER_SRC)

if __name__ == '__main__':
    ffi.compile()