forked from r9y9/pyopenjtalk
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: skrink macos brew & flags (Sourcery refactored) #5
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bcfa63a
fix macox build
synodriver 1b728e6
Merge branch 'speedup' of https://github.com/fumiama/pyopenjtalk into…
fumiama b3de875
fix args
fumiama acbebe5
add ignore
fumiama a342129
add link arg
fumiama 13d1d4b
r
fumiama 1fc6f63
eee
fumiama 1c493f5
Update setup.py
fumiama b7393e2
'Refactored by Sourcery'
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,3 +194,4 @@ Temporary Items | |
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
dic.tar.gz |
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 |
---|---|---|
|
@@ -93,11 +93,9 @@ def build_extensions(self): | |
extra_compile_args = ['-fopenmp'] | ||
extra_link_args = ['-fopenmp'] | ||
elif system == "Darwin": | ||
os.system("brew install llvm libomp") | ||
os.system("brew install clang-omp") | ||
# os.environ["CPP"] = "/usr/local/opt/llvm/bin/clang" | ||
extra_compile_args = ["-Xpreprocessor", "-fopenmp"] | ||
extra_link_args = ["-Xpreprocessor", "-fopenmp"] | ||
os.system('brew install libomp') | ||
extra_compile_args = ['-Xpreprocessor', '-fopenmp'] | ||
extra_link_args = ['-L/usr/local/lib', '-lomp'] | ||
else: | ||
extra_compile_args = ['-fopenmp'] | ||
extra_link_args = ['-fopenmp'] | ||
|
@@ -181,7 +179,7 @@ def update_to(self, b=1, bsize=1, tsize=None): | |
|
||
# extract dic | ||
filename = "dic.tar.gz" | ||
print('Downloading: "{}"'.format(_DICT_URL)) | ||
print(f'Downloading: "{_DICT_URL}"') | ||
with _TqdmUpTo( | ||
unit="B", | ||
unit_scale=True, | ||
|
@@ -191,7 +189,7 @@ def update_to(self, b=1, bsize=1, tsize=None): | |
) as t: # all optional kwargs | ||
urlretrieve(_DICT_URL, filename, reporthook=t.update_to) | ||
t.total = t.n | ||
print("Extracting tar file {}".format(filename)) | ||
print(f"Extracting tar file {filename}") | ||
with tarfile.open(filename, mode="r|gz") as f: | ||
f.extractall(path="./") | ||
os.remove(filename) | ||
|
@@ -237,7 +235,7 @@ def update_to(self, b=1, bsize=1, tsize=None): | |
ext_modules = [ | ||
Extension( | ||
name="pyopenjtalk.openjtalk", | ||
sources=[join("pyopenjtalk", "openjtalk" + ext)] + all_src, | ||
sources=[join("pyopenjtalk", f"openjtalk{ext}")] + all_src, | ||
include_dirs=[np.get_include()] + include_dirs, | ||
extra_compile_args=extra_compile_args, | ||
extra_link_args=extra_link_args, | ||
|
@@ -255,13 +253,14 @@ def update_to(self, b=1, bsize=1, tsize=None): | |
) | ||
] | ||
|
||
|
||
# Extension for HTSEngine backend | ||
htsengine_src_top = join("lib", "hts_engine_API", "src") | ||
all_htsengine_src = glob(join(htsengine_src_top, "lib", "*.c")) | ||
ext_modules += [ | ||
Extension( | ||
name="pyopenjtalk.htsengine", | ||
sources=[join("pyopenjtalk", "htsengine" + ext)] + all_htsengine_src, | ||
sources=[join("pyopenjtalk", f"htsengine{ext}")] + all_htsengine_src, | ||
include_dirs=[np.get_include(), join(htsengine_src_top, "include")], | ||
extra_compile_args=extra_compile_args, | ||
extra_link_args=extra_link_args, | ||
|
@@ -275,6 +274,7 @@ def update_to(self, b=1, bsize=1, tsize=None): | |
) | ||
] | ||
|
||
|
||
# Adapted from https://github.com/pytorch/pytorch | ||
cwd = os.path.dirname(os.path.abspath(__file__)) | ||
if os.getenv("PYOPENJTALK_BUILD_VERSION"): | ||
|
@@ -286,7 +286,7 @@ def update_to(self, b=1, bsize=1, tsize=None): | |
.decode("ascii") | ||
.strip() | ||
) | ||
version += "+" + sha[:7] | ||
version += f"+{sha[:7]}" | ||
except subprocess.CalledProcessError: | ||
pass | ||
except IOError: # FileNotFoundError for python 3 | ||
|
@@ -301,10 +301,10 @@ def run(self): | |
@staticmethod | ||
def create_version_file(): | ||
global version, cwd | ||
print("-- Building version " + version) | ||
print(f"-- 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)) | ||
f.write(f"__version__ = '{version}'\n") | ||
Comment on lines
302
to
+307
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
class develop(setuptools.command.develop.develop): | ||
|
@@ -336,7 +336,7 @@ def run(self): | |
cmdclass=cmdclass, | ||
install_requires=[ | ||
"numpy >= 1.20.0", | ||
"cython >= " + min_cython_ver, | ||
f"cython >= {min_cython_ver}", | ||
Comment on lines
337
to
+339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
"six", | ||
"tqdm", | ||
], | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines
182-287
refactored with the following changes:use-fstring-for-formatting
)use-fstring-for-concatenation
)