<commit_before>#!/usr/bin/env python

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from verifiers.helpers.dependencies import CommandDependency, DependencyVerifier, HeaderDirectoryDependency, HeaderFileDependency


class SystemPackageVerifier(object):

    def ensure_expected_system_components_are_installed(self):
        # perhaps load these dependency assertions from a YAML file in future
        verifier = DependencyVerifier()
        verifier.add(CommandDependency("mysql_config", "MySQL", "MySQL-python"))
        verifier.add(HeaderFileDependency("libiconv", "iconv.h", "lxml"))
        verifier.add(HeaderDirectoryDependency("libxml2", "lxml"))
        verifier.add(HeaderDirectoryDependency("libxslt", "lxml"))
        verifier.add(HeaderFileDependency("libjpeg", "jpeglib.h", "PIL"))

        print ">> Verifying expected system components for building Python modules:"
        verifier.verify_all()
        if verifier.not_all_dependencies_met():<commit_msg>[#6698487] (pb, ogl) Added system package check for zlib, which is required for building the Python Image Library (PIL).<commit_after>#!/usr/bin/env python

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from verifiers.helpers.dependencies import CommandDependency, DependencyVerifier, HeaderDirectoryDependency, HeaderFileDependency


class SystemPackageVerifier(object):

    def ensure_expected_system_components_are_installed(self):
        # perhaps load these dependency assertions from a YAML file in future
        verifier = DependencyVerifier()
        verifier.add(CommandDependency("mysql_config", "MySQL", "MySQL-python"))
        verifier.add(HeaderFileDependency("libiconv", "iconv.h", "lxml"))
        verifier.add(HeaderDirectoryDependency("libxml2", "lxml"))
        verifier.add(HeaderDirectoryDependency("libxslt", "lxml"))
        verifier.add(HeaderFileDependency("libjpeg", "jpeglib.h", "PIL"))
        verifier.add(HeaderFileDependency("zlib", "zlib.h", "PIL"))

        print ">> Verifying expected system components for building Python modules:"
        verifier.verify_all()
        if verifier.not_all_dependencies_met():
{'fraction_non_alphanumeric': 0.09901768172888016, 'fraction_numerical': 0.003536345776031434, 'mean_word_length': 4.546840958605665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4888382', 'n_tokens_mistral': 718, 'n_tokens_neox': 685, 'n_words': 198}