7
7
from io import BytesIO
8
8
import logging
9
9
import os
10
- import pathlib
10
+ from pathlib import Path
11
11
import platform
12
12
import shlex
13
13
import shutil
@@ -32,7 +32,7 @@ def _get_xdg_cache_dir():
32
32
cache_dir = os .path .expanduser ('~/.cache' )
33
33
if cache_dir .startswith ('~/' ): # Expansion failed.
34
34
return None
35
- return pathlib . Path (cache_dir , 'matplotlib' )
35
+ return Path (cache_dir , 'matplotlib' )
36
36
37
37
38
38
def _get_hash (data ):
@@ -219,10 +219,9 @@ def pkg_config_setup_extension(
219
219
conda_env_path = (os .getenv ('CONDA_PREFIX' ) # conda >= 4.1
220
220
or os .getenv ('CONDA_DEFAULT_ENV' )) # conda < 4.1
221
221
if conda_env_path and os .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" ))
226
225
227
226
# Default linked libs.
228
227
ext .libraries .extend (default_libraries )
@@ -304,7 +303,7 @@ def check(self):
304
303
305
304
def _pkg_data_helper (pkg , subdir ):
306
305
"""Glob "lib/$pkg/$subdir/**/*", returning paths relative to "lib/$pkg"."""
307
- base = pathlib . Path ("lib" , pkg )
306
+ base = Path ("lib" , pkg )
308
307
return [str (path .relative_to (base )) for path in (base / subdir ).rglob ("*" )]
309
308
310
309
@@ -527,8 +526,7 @@ def add_flags(self, ext):
527
526
default_libraries = ['freetype' ])
528
527
ext .define_macros .append (('FREETYPE_BUILD_TYPE' , 'system' ))
529
528
else :
530
- src_path = pathlib .Path (
531
- 'build' , f'freetype-{ LOCAL_FREETYPE_VERSION } ' )
529
+ src_path = Path ('build' , f'freetype-{ LOCAL_FREETYPE_VERSION } ' )
532
530
# Statically link to the locally-built freetype.
533
531
# This is certainly broken on Windows.
534
532
ext .include_dirs .insert (0 , str (src_path / 'include' ))
@@ -545,7 +543,7 @@ def do_custom_build(self):
545
543
if options .get ('system_freetype' ):
546
544
return
547
545
548
- src_path = pathlib . Path ('build' , f'freetype-{ LOCAL_FREETYPE_VERSION } ' )
546
+ src_path = Path ('build' , f'freetype-{ LOCAL_FREETYPE_VERSION } ' )
549
547
550
548
# We've already built freetype
551
549
if sys .platform == 'win32' :
@@ -595,13 +593,11 @@ def do_custom_build(self):
595
593
"--with-png=no" , "--with-harfbuzz=no" ],
596
594
env = env , cwd = src_path )
597
595
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 )
602
598
msbuild_platform = (
603
599
'x64' if platform .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" )
605
601
vc = 'vc2010'
606
602
sln_path = (
607
603
base_path / vc / "freetype.sln"
0 commit comments