Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
emfomy committed Nov 3, 2020
2 parents c97585b + 3e556ae commit d62c516
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 37 deletions.
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ Register an account at `http://parser.iis.sinica.edu.tw/v1/reg.exe`

.. code-block:: bash
pip install --force-reinstall --upgrade ckip-classic \
--install-option='--no-ws' \
--install-option='--no-parser'
pip install --upgrade ckip-classic
Installation Options
--------------------
Expand Down
2 changes: 1 addition & 1 deletion ckip_classic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__copyright__ = '2018-2020 CKIP Lab'

__title__ = 'CkipClassic'
__version__ = '1.1.0'
__version__ = '1.1.1'
__description__ = 'CKIP Classic NLP Tools'
__license__ = 'CC BY-NC-SA 4.0'

Expand Down
54 changes: 27 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,6 @@ def main():
],
python_requires='>=3.6',
packages=find_namespace_packages(include=['ckip_classic', 'ckip_classic.*',]),
ext_modules=cythonize(
[
Extension('ckip_classic._core.ws',
sources=['src/ws/ckipws.pyx'],
libraries=['WordSeg'],
language='c++',
),
Extension('ckip_classic._core.parser',
sources=['src/parser/ckipparser.pyx'],
libraries=['CKIPCoreNLP', 'CKIPParser', 'CKIPWS', 'CKIPSRL'],
language='c++',
),
],
build_dir='build',
),
data_files=[],
cmdclass={
'install': InstallCommand,
Expand Down Expand Up @@ -184,42 +169,57 @@ def finalize_options(self):

def run(self):

name2mod = {em.name: em for em in self.distribution.ext_modules}
self.distribution.ext_modules = []

# CKIPWS
if self.ws:
print('- Enable CKIPWS support')
if self.ws_lib_dir:
print('- Use CKIPWS library from "%s"' % self.ws_lib_dir)
mod_ws = name2mod['ckip_classic._core.ws']
mod_ws.library_dirs.append(self.ws_lib_dir)
mod_ws.runtime_library_dirs.append(self.ws_lib_dir)
mod_ws, = cythonize(
[
Extension('ckip_classic._core.ws',
sources=['src/ws/ckipws.pyx'],
libraries=['WordSeg'],
library_dirs=[self.ws_lib_dir],
runtime_library_dirs=[self.ws_lib_dir],
language='c++',
),
],
build_dir='build',
)
for lib in mod_ws.libraries:
libfile = os.path.join(self.ws_lib_dir, f'lib{lib}.so')
if not os.path.exists(libfile):
print(' - [WARNING] Shared library not exist: %s' % libfile)
self.distribution.ext_modules.append(mod_ws)
else:
print('- Disable CKIPWS support')
del name2mod['ckip_classic._core.ws']

# CKIPParser
if self.parser:
print('- Enable CKIPParser support')
if self.parser_lib_dir:
print('- Use CKIPParser library from "%s"' % self.parser_lib_dir)
mod_parser = name2mod['ckip_classic._core.parser']
mod_parser.library_dirs.append(self.parser_lib_dir)
mod_parser.runtime_library_dirs.append(self.parser_lib_dir)
mod_parser, = cythonize(
[
Extension('ckip_classic._core.parser',
sources=['src/parser/ckipparser.pyx'],
libraries=['CKIPCoreNLP', 'CKIPParser', 'CKIPWS', 'CKIPSRL'],
library_dirs=[self.parser_lib_dir],
runtime_library_dirs=[self.parser_lib_dir],
language='c++',
),
],
build_dir='build',
)
for lib in mod_parser.libraries:
libfile = os.path.join(self.parser_lib_dir, f'lib{lib}.so')
if not os.path.exists(libfile):
print(' - [WARNING] Shared library not exist: %s' % libfile)
self.distribution.ext_modules.append(mod_parser)
else:
print('- Disable CKIPParser support')
del name2mod['ckip_classic._core.parser']

# Re-register modules
self.distribution.ext_modules = list(name2mod.values())

# Data
if self.data2_dir:
Expand Down
1 change: 1 addition & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
..
python-dotenv
9 changes: 3 additions & 6 deletions test/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ commands =
{posargs}

[testenv:py36-client]
commands_pre =
- pip install -U python-dotenv
- pip install -U {toxinidir}/.. \
--install-option='--no-ws' \
--install-option='--no-parser' \
--quiet
deps =
{[testenv]deps}
-rrequirements.txt

commands =
pytest \
Expand Down

0 comments on commit d62c516

Please sign in to comment.