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

Fixes TypeError when installing without freetype #3414

Merged
merged 1 commit into from Aug 30, 2014
Merged

Fixes TypeError when installing without freetype #3414

merged 1 commit into from Aug 30, 2014

Conversation

remram44
Copy link
Contributor

When freetype-config is missing, setup.py crashes with TypeError. This fixes it and allows the "required packages" info to be printed.

Log of the error installing 1.4.0:

(venv-mpl)remram@vebian:~$ pip install -U matplotlib
Downloading/unpacking matplotlib
  Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
  Running setup.py (path:/tmp/venv-mpl/build/matplotlib/setup.py) egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.4.0]
                    python: yes [2.7.8 (default, Aug 10 2014, 16:19:34)  [GCC
                            4.9.1]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [not found. pip may install it below.]
                       six: yes [six was not found.]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may attempt to
                            install it after matplotlib.]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/venv-mpl/build/matplotlib/setup.py", line 154, in <module>
        result = package.check()
      File "setupext.py", line 940, in check
        if 'No such file or directory\ngrep:' in version:
    TypeError: argument of type 'NoneType' is not iterable
    Complete output from command python setup.py egg_info:
    ============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.4.0]

                python: yes [2.7.8 (default, Aug 10 2014, 16:19:34)  [GCC

                        4.9.1]]

              platform: yes [linux2]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [not found. pip may install it below.]

                   six: yes [six was not found.]

              dateutil: yes [dateutil was not found. It is required for date

                        axis support. pip/easy_install may attempt to

                        install it after matplotlib.]

               tornado: yes [tornado was not found. It is required for the

                        WebAgg backend. pip/easy_install may attempt to

                        install it after matplotlib.]

             pyparsing: yes [pyparsing was not found. It is required for

                        mathtext support. pip/easy_install may attempt to

                        install it after matplotlib.]

                 pycxx: yes [Couldn't import.  Using local copy.]

                libagg: yes [pkg-config information for 'libagg' could not

                        be found. Using local copy.]

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/venv-mpl/build/matplotlib/setup.py", line 154, in <module>

    result = package.check()

  File "setupext.py", line 940, in check

    if 'No such file or directory\ngrep:' in version:

TypeError: argument of type 'NoneType' is not iterable

----------------------------------------
Cleaning up...

@tacaswell tacaswell added this to the v1.4.x milestone Aug 26, 2014
@@ -937,7 +937,7 @@ def check(self):

# Early versions of freetype grep badly inside freetype-config,
# so catch those cases. (tested with 2.5.3).
if 'No such file or directory\ngrep:' in version:
if version is None or 'No such file or directory\ngrep:' in version:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be if version is not None and ... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is what I meant. The next line gets version another way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not obvious to me that what ever makes the call fail should be handled the same as the case this if statement is supposed to catch (where the call succeeds (returns 0), but does not work).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original pull request: #3363.

I think handling an invalid return value (the text "No such file or directory...") the same as an error code (status != 0) from freetype-config makes sense. The original PR really works around the fact that freetype-config exits with 0 on error here.

@tacaswell
Copy link
Member

@pelson Can you take a look at this?

@tacaswell
Copy link
Member

and @matthew-brett

@jperras
Copy link

jperras commented Aug 26, 2014

I ran into this exact issue moments ago. Applied the given pull request to the current HEAD, installed manually via python setup.py install, and it installed as expected.

@pelson
Copy link
Member

pelson commented Aug 30, 2014

👍 - thanks for this.

pelson added a commit that referenced this pull request Aug 30, 2014
Fixes TypeError when installing without freetype
@pelson pelson merged commit 08c41b1 into matplotlib:v1.4.x Aug 30, 2014
@remram44 remram44 deleted the fix-missing-freetype branch August 30, 2014 14:01
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

Successfully merging this pull request may close these issues.

None yet

5 participants