@@ -518,14 +518,23 @@ def get_mupdf():
518
518
extra_link_args = []
519
519
extra_compile_args = []
520
520
521
+ log ( f'platform.system()={ platform .system ()!r} ' )
522
+ log ( f'sys.platform={ sys .platform !r} ' )
523
+
524
+ linux = platform .system () == 'Linux'
525
+ openbsd = platform .system () == 'OpenBSD'
526
+ freebsd = platform .system () == 'FreeBSD'
527
+ darwin = platform .system () == 'Darwin'
528
+ windows = platform .system () == 'Windows' or platform .system ().startswith ('CYGWIN' )
529
+
521
530
if 'sdist' in sys .argv :
522
531
# Create local mupdf.tgz, for inclusion in sdist.
523
532
get_mupdf_tgz ()
524
533
525
534
526
535
if ('-h' not in sys .argv and '--help' not in sys .argv
527
- and (
528
- 'bdist_wheel' in sys .argv
536
+ and (0
537
+ or 'bdist_wheel' in sys .argv
529
538
or 'build' in sys .argv
530
539
or 'bdist' in sys .argv
531
540
or 'install' in sys .argv
@@ -560,7 +569,7 @@ def get_mupdf():
560
569
log ( f'Building mupdf.' )
561
570
shutil .copy2 ( 'fitz/_config.h' , f'{ mupdf_local } include/mupdf/fitz/config.h' )
562
571
563
- if platform . system () == 'Windows' or platform . system (). startswith ( 'CYGWIN' ) :
572
+ if windows :
564
573
# Windows build.
565
574
devenv = os .environ .get ('PYMUPDF_SETUP_DEVENV' )
566
575
if not devenv :
@@ -587,9 +596,9 @@ def get_mupdf():
587
596
flags += ' verbose=yes'
588
597
env = ''
589
598
make = 'make'
590
- if os . uname ()[ 0 ] == 'Linux' :
599
+ if linux :
591
600
env += ' CFLAGS="-fPIC"'
592
- if os . uname ()[ 0 ] in ( 'OpenBSD' , 'FreeBSD' ) :
601
+ if openbsd or freebsd :
593
602
make = 'gmake'
594
603
env += ' CFLAGS="-fPIC" CXX=clang++'
595
604
@@ -646,13 +655,6 @@ def get_mupdf():
646
655
if unix_build_dir :
647
656
library_dirs .append ( unix_build_dir )
648
657
649
- log ( f'sys.platform={ sys .platform !r} ' )
650
-
651
- linux = sys .platform .startswith ( 'linux' ) or 'gnu' in sys .platform
652
- openbsd = sys .platform .startswith ( 'openbsd' )
653
- freebsd = sys .platform .startswith ( 'freebsd' )
654
- darwin = sys .platform .startswith ( 'darwin' )
655
-
656
658
if mupdf_local and (linux or openbsd or freebsd ):
657
659
# setuptools' link command always seems to put '-L
658
660
# /usr/local/lib' before any <library_dirs> that we specify,
@@ -703,13 +705,13 @@ def get_mupdf():
703
705
704
706
library_dirs .append ("/opt/homebrew/lib" )
705
707
706
- if sys . platform . startswith ( ' freebsd' ) :
708
+ if freebsd :
707
709
libraries += [
708
710
'freetype' ,
709
711
'harfbuzz' ,
710
712
]
711
713
712
- else :
714
+ elif windows :
713
715
# Windows.
714
716
assert mupdf_local
715
717
if word_size () == 32 :
@@ -725,6 +727,9 @@ def get_mupdf():
725
727
]
726
728
extra_link_args = ["/NODEFAULTLIB:MSVCRT" ]
727
729
730
+ else :
731
+ assert 0 , 'Unrecognised OS'
732
+
728
733
if linux or openbsd or freebsd or darwin :
729
734
extra_compile_args .append ( '-Wno-incompatible-pointer-types' )
730
735
extra_compile_args .append ( '-Wno-pointer-sign' )
@@ -742,13 +747,6 @@ def get_mupdf():
742
747
include_dirs += local_dirs .get ("include_dirs" , [])
743
748
library_dirs += local_dirs .get ("library_dirs" , [])
744
749
745
- if 1 :
746
- # Diagnostics.
747
- log ( f'library_dirs={ library_dirs } ' )
748
- log ( f'libraries={ libraries } ' )
749
- log ( f'include_dirs={ include_dirs } ' )
750
- log ( f'extra_link_args={ extra_link_args } ' )
751
-
752
750
log ( f'include_dirs={ include_dirs } ' )
753
751
log ( f'library_dirs={ library_dirs } ' )
754
752
log ( f'libraries={ libraries } ' )
0 commit comments