Skip to content

Commit

Permalink
1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunwoongko committed Aug 23, 2022
1 parent 43d96df commit 45c86a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion mecab/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.1.10"
version = "1.2.1"
7 changes: 2 additions & 5 deletions scripts/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ if [[ ! $os == "Linux" ]] && [[ ! $os == "Darwin" ]]; then
fi

install_requirements(){
# TODO: if not [automake --version]
if [ "$os" == "Linux" ]; then
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
$sudo apt-get update && $sudo apt-get install -y build-essential curl python3-devel libmecab-dev git
$sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC && $sudo apt-get update && $sudo apt-get install build-essential curl python3-dev libmecab-dev git -y
elif [ "$(grep -Ei 'fedora|redhat' /etc/*release)" ]; then
$sudo yum groupinstall -y 'Development Tools' 'Development Libraries' && $sudo yum install -y curl python3-devel git
$sudo yum groupinstall 'Development Tools' 'Development Libraries' -y && $sudo yum install curl python3-devel git -y
fi
elif [ "$os" == "Darwin" ]; then
if [[ $(command -v brew) == "" ]]; then
Expand All @@ -39,8 +38,6 @@ install_requirements(){
brew install curl git
fi
fi

$python -m pip install wheel pybind11~=2.9.0
}

install_requirements
33 changes: 14 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from setuptools import find_packages, setup, Extension
from setuptools.command.build_ext import build_ext
from setuptools.command.build_py import build_py
from setuptools.command.install import install

# Based on https://github.com/pybind/python_example

Expand All @@ -17,17 +16,6 @@
requirements_installed = False


class BuildPyCommand(build_py):
def run(self):
output = super().run()
subprocess.check_call(
f"bash {os.path.join(scripts_directory, 'install_requirements.sh')}",
cwd=scripts_directory,
shell=True,
)
return output


class BuildExtensionCommand(build_ext):
compiler_options = {
"msvc": ["/EHsc"],
Expand Down Expand Up @@ -91,16 +79,24 @@ def _cpp_flag(self):
)


class InstallCommand(install):
def run(self):
class InstallRequirements(build_py):
def run(self) -> None:
subprocess.check_call(
["bash", os.path.join(scripts_directory, "install_requirements.sh")],
cwd=scripts_directory,
)
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "wheel", "pybind11~=2.9.0"],
cwd=scripts_directory,
)

if not shutil.which("mecab"):
subprocess.check_call(
f"bash {os.path.join(scripts_directory, 'install_mecab_ko_dic.sh')}",
["bash", os.path.join(scripts_directory, "install_mecab_ko_dic.sh")],
cwd=scripts_directory,
shell=True,
)

super().run()
return super(InstallRequirements, self).run()


def lazy(func):
Expand Down Expand Up @@ -203,8 +199,7 @@ def get_mecab_library_directory():
],
packages=find_packages(),
cmdclass={
"install": InstallCommand,
"build_py": BuildPyCommand,
"build_py": InstallRequirements,
"build_ext": BuildExtensionCommand,
},
)

0 comments on commit 45c86a4

Please sign in to comment.