1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
From: Filip Pytloun <filip@pytloun.cz>
Date: Tue, 12 Sep 2017 11:11:38 +0200
Subject: Don't use bundled libdatrie
Forwarded: not-needed
Last-Update: 2020-11-04
---
MANIFEST.in | 2 --
setup.py | 8 +-------
src/cdatrie.pxd | 6 +++---
3 files changed, 4 insertions(+), 12 deletions(-)
--- python-datrie.orig/MANIFEST.in
+++ python-datrie/MANIFEST.in
@@ -4,8 +4,6 @@
include tox.ini
include tox-bench.ini
include update_c.sh
-recursive-include libdatrie *.h
-recursive-include libdatrie *.c
include tests/words100k.txt.zip
recursive-include tests *.py
--- python-datrie.orig/setup.py
+++ python-datrie/setup.py
@@ -7,9 +7,7 @@
from setuptools import setup, Extension
from Cython.Build import cythonize
-
-LIBDATRIE_DIR = 'libdatrie'
-LIBDATRIE_FILES = sorted(glob.glob(os.path.join(LIBDATRIE_DIR, "datrie", "*.c")))
+from Cython.Build.Dependencies import default_create_extension
DESCRIPTION = __doc__
LONG_DESCRIPTION = open('README.rst').read() + open('CHANGES.rst').read()
@@ -41,16 +39,19 @@
'Topic :: Text Processing :: Linguistic'
]
+def debian_create_extension(template, kwds):
+ libs = kwds.get('libraries', []) + ["datrie"]
+ kwds['libraries'] = libs
+ return default_create_extension(template, kwds)
+
ext_modules = cythonize(
'src/datrie.pyx', 'src/cdatrie.pxd', 'src/stdio_ext.pxd',
annotate=True,
include_path=[os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")],
- language_level=2
+ language_level=2,
+ create_extension=debian_create_extension
)
-for m in ext_modules:
- m.include_dirs=[LIBDATRIE_DIR]
-
setup(name="datrie",
version="0.8.3",
description=DESCRIPTION,
@@ -60,9 +61,6 @@
license=LICENSE,
url='https://github.com/kmike/datrie',
classifiers=CLASSIFIERS,
- libraries=[('datrie', {
- "sources": LIBDATRIE_FILES,
- "include_dirs": [LIBDATRIE_DIR]})],
ext_modules=ext_modules,
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
setup_requires=['Cython>=0.28'],
--- python-datrie.orig/src/cdatrie.pxd
+++ python-datrie/src/cdatrie.pxd
@@ -1,13 +1,13 @@
# cython: profile=False
from libc cimport stdio
-cdef extern from "../libdatrie/datrie/triedefs.h":
+cdef extern from "/usr/include/datrie/triedefs.h":
ctypedef int AlphaChar # it should be utf32 letter
ctypedef unsigned char TrieChar # 1 byte
ctypedef int TrieIndex
ctypedef int TrieData # int
-cdef extern from "../libdatrie/datrie/alpha-map.h":
+cdef extern from "/usr/include/datrie/alpha-map.h":
ctypedef struct AlphaMap:
pass
@@ -20,7 +20,7 @@
int alpha_char_strlen (AlphaChar *str)
-cdef extern from "../libdatrie/datrie/trie.h":
+cdef extern from "/usr/include/datrie/trie.h":
ctypedef struct Trie:
pass
|