Skip to content

Commit

Permalink
Merge tag 'v0.3.2' into merge-upstream-0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Sep 8, 2023
2 parents ba5a316 + e6bc65f commit 6aca08a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[lint]"
pip install -e ".[dev]"
- name: Lint with pysen
run: |
pysen run lint
Expand Down
4 changes: 2 additions & 2 deletions pyopenjtalk/htsengine.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ np.import_array()
cimport cython
from libc.stdlib cimport malloc, free

from htsengine cimport HTS_Engine
from htsengine cimport (
from .htsengine cimport HTS_Engine
from .htsengine cimport (
HTS_Engine_initialize, HTS_Engine_load, HTS_Engine_clear, HTS_Engine_refresh,
HTS_Engine_get_sampling_frequency, HTS_Engine_get_fperiod,
HTS_Engine_set_speed, HTS_Engine_add_half_tone,
Expand Down
24 changes: 12 additions & 12 deletions pyopenjtalk/openjtalk.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ np.import_array()
cimport cython
from libc.stdlib cimport calloc

from openjtalk.mecab cimport Mecab, Mecab_initialize, Mecab_load, Mecab_analysis
from openjtalk.mecab cimport Mecab_get_feature, Mecab_get_size, Mecab_refresh, Mecab_clear
from openjtalk.mecab cimport mecab_dict_index, createModel, Model, Tagger, Lattice
from openjtalk.njd cimport NJD, NJD_initialize, NJD_refresh, NJD_print, NJD_clear
from openjtalk cimport njd as _njd
from openjtalk.jpcommon cimport JPCommon, JPCommon_initialize,JPCommon_make_label
from openjtalk.jpcommon cimport JPCommon_get_label_size, JPCommon_get_label_feature
from openjtalk.jpcommon cimport JPCommon_refresh, JPCommon_clear
from openjtalk cimport njd2jpcommon
from openjtalk.text2mecab cimport text2mecab
from openjtalk.mecab2njd cimport mecab2njd
from openjtalk.njd2jpcommon cimport njd2jpcommon
from .openjtalk.mecab cimport Mecab, Mecab_initialize, Mecab_load, Mecab_analysis
from .openjtalk.mecab cimport Mecab_get_feature, Mecab_get_size, Mecab_refresh, Mecab_clear
from .openjtalk.mecab cimport mecab_dict_index, createModel, Model, Tagger, Lattice
from .openjtalk.njd cimport NJD, NJD_initialize, NJD_refresh, NJD_print, NJD_clear
from .openjtalk cimport njd as _njd
from .openjtalk.jpcommon cimport JPCommon, JPCommon_initialize,JPCommon_make_label
from .openjtalk.jpcommon cimport JPCommon_get_label_size, JPCommon_get_label_feature
from .openjtalk.jpcommon cimport JPCommon_refresh, JPCommon_clear
from .openjtalk cimport njd2jpcommon
from .openjtalk.text2mecab cimport text2mecab
from .openjtalk.mecab2njd cimport mecab2njd
from .openjtalk.njd2jpcommon cimport njd2jpcommon
from libc.string cimport strlen

cdef inline int Mecab_load_ex(Mecab *m, char* dicdir, char* userdic):
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[build-system]
requires = [
"wheel",
"setuptools<v60.0",
"cython>=0.28.0, <3.0", # NOTE: https://github.com/r9y9/pyopenjtalk/issues/55
"numpy>=1.20.0",
"cython>=0.28.0,<3.0.0",
"cmake",
"numpy>=1.25.0; python_version>='3.9'",
"oldest-supported-numpy; python_version<'3.9'",
]
build-backend = "setuptools.build_meta"

[tool.pysen]
version = "0.10.2"
Expand Down
44 changes: 41 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

platform_is_windows = sys.platform == "win32"

version = "0.3.0"
version = "0.3.2"

min_cython_ver = "0.21.0"
try:
Expand Down Expand Up @@ -71,6 +71,43 @@ def build_extensions(self):
raise RuntimeError("Cython is required to generate C++ code")


def check_cmake_in_path():
try:
result = subprocess.run(
["cmake", "--version"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
if result.returncode == 0:
# CMake is in the system path
return True, result.stdout.strip()
else:
# CMake is not in the system path
return False, None
except FileNotFoundError:
# CMake command not found
return False, None


if os.name == "nt": # Check if the OS is Windows
# Check if CMake is in the system path
cmake_found, cmake_version = check_cmake_in_path()

if cmake_found:
print(
f"CMake is in the system path. Version: \
{cmake_version}"
)
else:
raise SystemError(
"CMake is not found in the \
system path. Make sure CMake \
is installed and in the system \
path."
)


# Workaround for `distutils.spawn` problem on Windows python < 3.9
# See details: [bpo-39763: distutils.spawn now uses subprocess (GH-18743)]
# (https://github.com/python/cpython/commit/1ec63b62035e73111e204a0e03b83503e1c58f2e)
Expand Down Expand Up @@ -277,7 +314,6 @@ def run(self):
cmdclass=cmdclass,
install_requires=[
"numpy >= 1.20.0",
"cython >= " + min_cython_ver,
"six",
"tqdm",
],
Expand All @@ -291,7 +327,8 @@ def run(self):
"ipython",
"jupyter",
],
"lint": [
"dev": [
"cython >= " + min_cython_ver + ",<3.0.0",
"pysen",
"types-setuptools",
"mypy<=0.910",
Expand All @@ -301,6 +338,7 @@ def run(self):
"flake8-bugbear",
"isort>=4.3,<5.2.0",
"types-decorator",
"importlib-metadata<5.0",
],
"test": ["pytest", "scipy"],
"marine": ["marine>=0.0.5"],
Expand Down

0 comments on commit 6aca08a

Please sign in to comment.