Skip to content
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

pymupdf-1.21.0rc2: setup.py, line 724: NameError: name 'unix_build_type' is not defined #2101

Closed
sedimentation-fault opened this issue Dec 4, 2022 · 1 comment

Comments

@sedimentation-fault
Copy link

Description

PYMUPDF_SETUP_MUPDF_BUILD='' python setup.py install

breaks with the error:

PyMuPDF/setup.py: PYMUPDF_SETUP_MUPDF_BUILD="", using system mupdf
PyMuPDF/setup.py: mupdf_local=None
PyMuPDF/setup.py: Using system mupdf.
PyMuPDF/setup.py: sys.platform='linux'
Traceback (most recent call last):
File "/usr/src/pymupdf-1.21.0rc2/setup.py", line 724, in
if unix_build_type == 'memento':
NameError: name 'unix_build_type' is not defined. Did you mean: 'unix_build_dir'?

How To Reproduce

Extract PyMuPDF-1.21.0rc2.tar.gz to pymupdf-1.21.0rc2/.
cd pymupdf-1.21.0rc2/
PYMUPDF_SETUP_MUPDF_BUILD='' python setup.py install

I get the error shown above.

Expected behavior

A smooth installation (obvious).

Configuration

  • Operating system: Gentoo
  • Python version: 3.10
  • PyMuPDF version, installation method (wheel or generated from source): source, as shown above. Version: 1.21.0rc2.

Additional context

Looking at the output of setup.py just before the error (see above), we see that it got the PYMUPDF_SETUP_MUPDF_BUILD environment variable:

...using system mupdf

and also that

mupdf_local=None

Looking at the code of setup.py, we see that unix_build_type is computed as

        unix_build_type = os.environ.get( 'PYMUPDF_SETUP_MUPDF_BUILD_TYPE', 'release')

only inside a "if mupdf_local" block - but mupdf_local is None, so the error says the truth, unix_build_type is not defined in that case (i.e. when the user wants to use an already installed mupdf). :-)

Solution

Add

unix_build_type = os.environ.get( 'PYMUPDF_SETUP_MUPDF_BUILD_TYPE', 'release')

to the "else" part of that "if", or put it before the "if" block, since it is used in both blocks. Didn't try it (yet), but looks pure logic to me...

@julian-smith-artifex-com
Copy link
Collaborator

Thanks for this report, but it's already been reported in #2039, and will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants