⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 294379 in webkit


Ignore:
Timestamp:
May 17, 2022, 6:45:35 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

[WPE][GTK] generate-pdfjs-gresource-manifest.py should be more careful about unknown files
​https://bugs.webkit.org/show_bug.cgi?id=240536

Patch by Michael Catanzaro <​mcatanzaro@redhat.com> on 2022-05-17
Reviewed by Adrian Perez de Castro.

Instead of silently ignoring unexpected files, let's create a list of
all files that we do not want to include in the resource manifest.
Anything unexpected will result in a build failure so that there are no
mistakes.

Also, change the lists at the top of the script into sets. Adrian
noticed that they do not need to be ordered.

  • Tools/glib/generate-pdfjs-gresource-manifest.py:

(get_filenames):
(get_filenames.should_ignore_resource): Deleted.

Canonical link: ​https://commits.webkit.org/250668@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/glib/generate-pdfjs-gresource-manifest.py

    r291094 r294379  
    2020import sys
    2121
    22 VALID_EXTENSIONS = ['.html', '.js', '.css', '.svg', '.png', '.gif', '.cur', '.bcmap', '.properties', '.pfb', '.ttf']
    23 COMPRESSIBLE_EXTENSIONS = ['.html', '.js', '.css', '.svg', '.properties']
    24 BASE_DIRS = ['pdfjs/', 'pdfjs-extras/']
     22VALID_EXTENSIONS = {'.html', '.js', '.css', '.svg', '.png', '.gif', '.cur', '.bcmap', '.properties', '.pfb', '.ttf'}
     23COMPRESSIBLE_EXTENSIONS = {'.html', '.js', '.css', '.svg', '.properties'}
     24BASE_DIRS = {'pdfjs/', 'pdfjs-extras/'}
     25
     26IGNORE = {'LICENSE',
     27          'README.webkit',
     28          'web/cmaps/LICENSE',
     29          'web/standard_fonts/LICENSE_FOXIT',
     30          'web/standard_fonts/LICENSE_LIBERATION'}
    2531
    2632
    2733def get_filenames(directory):
    2834    filenames = []
    29 
    30     def should_ignore_resource(resource):
    31         if os.path.splitext(resource)[1] not in VALID_EXTENSIONS:
    32             return True
    3335
    3436    def resource_name(filename):
    … …  
    5456            if os.sep != '/':
    5557                name = name.replace(os.sep, '/')
    56             if not should_ignore_resource(name):
     58            if name not in IGNORE:
     59                if os.path.splitext(name)[1] not in VALID_EXTENSIONS:
     60                    print('Unexpected file %s, please teach generate-pdfjs-gresource-manifest.py how to handle it' % filename, file=sys.stderr)
     61                    sys.exit(1)
    5762                filenames.append(name)
    5863
Note: See TracChangeset for help on using the changeset viewer.