Skip to content

Commit

Permalink
fix cython import
Browse files Browse the repository at this point in the history
  • Loading branch information
luoruixuan committed Jun 21, 2020
1 parent becc57e commit d581c95
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import setuptools
import os
from distutils.extension import Extension

import numpy as np
from Cython.Build import cythonize

def is_source_release(path):
return os.path.exists(os.path.join(path, "PKG-INFO"))

def setup_package():
root = os.path.abspath(os.path.dirname(__file__))

long_description = "pkuseg-python"

Expand All @@ -26,10 +30,15 @@ def setup_package():
include_dirs=[np.get_include()],
),
]

if not is_source_release(root):
from Cython.Build import cythonize
extensions = cythonize(extensions, annotate=True)


setuptools.setup(
name="pkuseg",
version="0.0.22",
version="0.0.25",
author="Lanco",
author_email="[email protected]",
description="A small package for Chinese word segmentation",
Expand All @@ -43,9 +52,9 @@ def setup_package():
"License :: Other/Proprietary License",
"Operating System :: OS Independent",
],
install_requires=["numpy>=1.16.0"],
install_requires=["cython", "numpy>=1.16.0"],
setup_requires=["cython", "numpy>=1.16.0"],
ext_modules=cythonize(extensions, annotate=True),
ext_modules=extensions,
zip_safe=False,
)

Expand Down

0 comments on commit d581c95

Please sign in to comment.