-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from sabonerune/bld/declarative-config
BLD: Declarative config
- Loading branch information
Showing
6 changed files
with
84 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
include README.md LICENSE.md | ||
recursive-include pyopenjtalk *.cpp *.pxd *.md *.pyx | ||
include pyopenjtalk/version.py | ||
exclude .gitignore .gitmodules .travis.yml release.sh tox.ini | ||
prune .github/* | ||
prune docs/** | ||
recursive-include lib *.cpp *.c *.h README LICENSE COPYING CMakeLists.txt *.in | ||
exclude lib/open_jtalk/src/mecab/src/config.h | ||
prune lib/open_jtalk/src/build/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,84 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=66.1.0; python_version>='3.12'", | ||
"setuptools>=60.0.0; sys.platform=='win32'", | ||
"setuptools<v60.0; python_version<'3.12' and sys.platform!='win32'", | ||
"setuptools>=64", | ||
"setuptools_scm>=8", | ||
"cython>=0.28.0", | ||
"cmake", | ||
"numpy>=1.25.0; python_version>='3.9'", | ||
"oldest-supported-numpy; python_version<'3.9'", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "pyopenjtalk" | ||
dynamic = ["version"] | ||
description = "A python wrapper for OpenJTalk" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
license.file = "LICENSE.md" | ||
authors = [{ name = "Ryuichi Yamamoto", email = "[email protected]" }] | ||
keywords = ["OpenJTalk", "Research"] | ||
classifiers = [ | ||
"Operating System :: POSIX", | ||
"Operating System :: Unix", | ||
"Operating System :: MacOS", | ||
"Operating System :: Microsoft :: Windows", | ||
"Programming Language :: Cython", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"License :: OSI Approved :: MIT License", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Software Development", | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Developers", | ||
] | ||
urls.Homepage = "https://github.com/r9y9/pyopenjtalk" | ||
dependencies = [ | ||
"importlib_resources; python_version<'3.9'", | ||
"numpy>=1.20.0", | ||
"tqdm", | ||
] | ||
|
||
[project.optional-dependencies] | ||
docs = [ | ||
"sphinx_rtd_theme", | ||
"nbsphinx>=0.8.6", | ||
"Jinja2>=3.0.1", | ||
"pandoc", | ||
"ipython", | ||
"jupyter", | ||
] | ||
dev = [ | ||
"cython>=0.28.0", | ||
"pysen", | ||
"types-setuptools", | ||
"mypy<=0.910", | ||
"black>=19.19b0,<=20.8", | ||
"click<8.1.0", | ||
"flake8>=3.7,<4", | ||
"flake8-bugbear", | ||
"isort>=4.3,<5.2.0", | ||
"types-decorator", | ||
"importlib-metadata<5.0", | ||
] | ||
test = ["pytest", "scipy"] | ||
marine = ["marine>=0.0.5"] | ||
|
||
[tool.setuptools.packages] | ||
find.namespaces = false | ||
|
||
[tool.setuptools.exclude-package-data] | ||
"*" = ["*.pyx", "*.pxd"] | ||
|
||
[tool.setuptools_scm] | ||
version_file = "pyopenjtalk/version.py" | ||
version_file_template = ''' | ||
__version__ = "{version}" | ||
''' | ||
|
||
[tool.pysen] | ||
version = "0.10.2" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,13 @@ | |
from glob import glob | ||
from itertools import chain | ||
from os.path import exists, join | ||
from subprocess import run | ||
|
||
import numpy as np | ||
import setuptools.command.build_ext | ||
import setuptools.command.build_py | ||
import setuptools.command.develop | ||
from setuptools import Extension, find_packages, setup | ||
from setuptools import Extension, setup | ||
|
||
platform_is_windows = sys.platform == "win32" | ||
|
||
version = "0.3.5-dev" | ||
|
||
msvc_extra_compile_args_config = [ | ||
"/source-charset:utf-8", | ||
"/execution-charset:utf-8", | ||
|
@@ -93,7 +88,9 @@ def check_cmake_in_path(): | |
|
||
# NOTE: The wrapped OpenJTalk does not depend on HTS_Engine, | ||
# but since HTSEngine is included in CMake's dependencies, it refers to a dummy path. | ||
r = run(["cmake", "..", "-DHTS_ENGINE_INCLUDE_DIR=.", "-DHTS_ENGINE_LIB=dummy"]) | ||
r = subprocess.run( | ||
["cmake", "..", "-DHTS_ENGINE_INCLUDE_DIR=.", "-DHTS_ENGINE_LIB=dummy"] | ||
) | ||
r.check_returncode() | ||
os.chdir(cwd) | ||
|
||
|
@@ -155,109 +152,4 @@ def check_cmake_in_path(): | |
) | ||
] | ||
|
||
# Adapted from https://github.com/pytorch/pytorch | ||
cwd = os.path.dirname(os.path.abspath(__file__)) | ||
if os.getenv("PYOPENJTALK_BUILD_VERSION"): | ||
version = os.getenv("PYOPENJTALK_BUILD_VERSION") | ||
else: | ||
try: | ||
sha = ( | ||
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=cwd) | ||
.decode("ascii") | ||
.strip() | ||
) | ||
version += "+" + sha[:7] | ||
except subprocess.CalledProcessError: | ||
pass | ||
except IOError: # FileNotFoundError for python 3 | ||
pass | ||
|
||
|
||
class build_py(setuptools.command.build_py.build_py): | ||
def run(self): | ||
self.create_version_file() | ||
setuptools.command.build_py.build_py.run(self) | ||
|
||
@staticmethod | ||
def create_version_file(): | ||
global version, cwd | ||
print("-- Building version " + version) | ||
version_path = os.path.join(cwd, "pyopenjtalk", "version.py") | ||
with open(version_path, "w") as f: | ||
f.write("__version__ = '{}'\n".format(version)) | ||
|
||
|
||
class develop(setuptools.command.develop.develop): | ||
def run(self): | ||
build_py.create_version_file() | ||
setuptools.command.develop.develop.run(self) | ||
|
||
|
||
with open("README.md", "r", encoding="utf8") as fd: | ||
long_description = fd.read() | ||
|
||
setup( | ||
name="pyopenjtalk", | ||
version=version, | ||
description="A python wrapper for OpenJTalk", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
author="Ryuichi Yamamoto", | ||
author_email="[email protected]", | ||
url="https://github.com/r9y9/pyopenjtalk", | ||
license="MIT", | ||
packages=find_packages(), | ||
package_data={"": ["htsvoice/*"]}, | ||
ext_modules=ext_modules, | ||
cmdclass={"build_ext": custom_build_ext, "build_py": build_py, "develop": develop}, | ||
install_requires=[ | ||
"importlib_resources; python_version<'3.9'", | ||
"numpy >= 1.20.0", | ||
"tqdm", | ||
], | ||
tests_require=["nose", "coverage"], | ||
extras_require={ | ||
"docs": [ | ||
"sphinx_rtd_theme", | ||
"nbsphinx>=0.8.6", | ||
"Jinja2>=3.0.1", | ||
"pandoc", | ||
"ipython", | ||
"jupyter", | ||
], | ||
"dev": [ | ||
"cython>=0.28.0", | ||
"pysen", | ||
"types-setuptools", | ||
"mypy<=0.910", | ||
"black>=19.19b0,<=20.8", | ||
"click<8.1.0", | ||
"flake8>=3.7,<4", | ||
"flake8-bugbear", | ||
"isort>=4.3,<5.2.0", | ||
"types-decorator", | ||
"importlib-metadata<5.0", | ||
], | ||
"test": ["pytest", "scipy"], | ||
"marine": ["marine>=0.0.5"], | ||
}, | ||
classifiers=[ | ||
"Operating System :: POSIX", | ||
"Operating System :: Unix", | ||
"Operating System :: MacOS", | ||
"Operating System :: Microsoft :: Windows", | ||
"Programming Language :: Cython", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"License :: OSI Approved :: MIT License", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Software Development", | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Developers", | ||
], | ||
keywords=["OpenJTalk", "Research"], | ||
) | ||
setup(ext_modules=ext_modules, cmdclass={"build_ext": custom_build_ext}) |