Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65b80e8

Browse files
committed
Shorter Path import in setupext.
Now that there's no `class Path` in setupext anymore, we can just do`from pathlib import Path`.
1 parent382be60 commit65b80e8

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

‎setupext.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
fromioimportBytesIO
88
importlogging
99
importos
10-
importpathlib
10+
frompathlibimportPath
1111
importplatform
1212
importshlex
1313
importshutil
@@ -32,7 +32,7 @@ def _get_xdg_cache_dir():
3232
cache_dir=os.path.expanduser('~/.cache')
3333
ifcache_dir.startswith('~/'):# Expansion failed.
3434
returnNone
35-
returnpathlib.Path(cache_dir,'matplotlib')
35+
returnPath(cache_dir,'matplotlib')
3636

3737

3838
def_get_hash(data):
@@ -219,10 +219,9 @@ def pkg_config_setup_extension(
219219
conda_env_path= (os.getenv('CONDA_PREFIX')# conda >= 4.1
220220
oros.getenv('CONDA_DEFAULT_ENV'))# conda < 4.1
221221
ifconda_env_pathandos.path.isdir(conda_env_path):
222-
ext.include_dirs.append(os.fspath(
223-
pathlib.Path(conda_env_path,"Library/include")))
224-
ext.library_dirs.append(os.fspath(
225-
pathlib.Path(conda_env_path,"Library/lib")))
222+
conda_env_path=Path(conda_env_path)
223+
ext.include_dirs.append(str(conda_env_path/"Library/include"))
224+
ext.library_dirs.append(str(conda_env_path/"Library/lib"))
226225

227226
# Default linked libs.
228227
ext.libraries.extend(default_libraries)
@@ -304,7 +303,7 @@ def check(self):
304303

305304
def_pkg_data_helper(pkg,subdir):
306305
"""Glob "lib/$pkg/$subdir/**/*", returning paths relative to "lib/$pkg"."""
307-
base=pathlib.Path("lib",pkg)
306+
base=Path("lib",pkg)
308307
return [str(path.relative_to(base))forpathin (base/subdir).rglob("*")]
309308

310309

@@ -527,8 +526,7 @@ def add_flags(self, ext):
527526
default_libraries=['freetype'])
528527
ext.define_macros.append(('FREETYPE_BUILD_TYPE','system'))
529528
else:
530-
src_path=pathlib.Path(
531-
'build',f'freetype-{LOCAL_FREETYPE_VERSION}')
529+
src_path=Path('build',f'freetype-{LOCAL_FREETYPE_VERSION}')
532530
# Statically link to the locally-built freetype.
533531
# This is certainly broken on Windows.
534532
ext.include_dirs.insert(0,str(src_path/'include'))
@@ -545,7 +543,7 @@ def do_custom_build(self):
545543
ifoptions.get('system_freetype'):
546544
return
547545

548-
src_path=pathlib.Path('build',f'freetype-{LOCAL_FREETYPE_VERSION}')
546+
src_path=Path('build',f'freetype-{LOCAL_FREETYPE_VERSION}')
549547

550548
# We've already built freetype
551549
ifsys.platform=='win32':
@@ -595,13 +593,11 @@ def do_custom_build(self):
595593
"--with-png=no","--with-harfbuzz=no"],
596594
env=env,cwd=src_path)
597595
subprocess.check_call(["make"],env=env,cwd=src_path)
598-
else:
599-
# compilation on windows
600-
shutil.rmtree(str(pathlib.Path(src_path,"objs")),
601-
ignore_errors=True)
596+
else:# compilation on windows
597+
shutil.rmtree(str(Path(src_path,"objs")),ignore_errors=True)
602598
msbuild_platform= (
603599
'x64'ifplatform.architecture()[0]=='64bit'else'Win32')
604-
base_path=pathlib.Path("build/freetype-2.6.1/builds/windows")
600+
base_path=Path("build/freetype-2.6.1/builds/windows")
605601
vc='vc2010'
606602
sln_path= (
607603
base_path/vc/"freetype.sln"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp