<commit_before>## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
import os
import sys
import re
import zipfile

from qisys.qixml import etree
import qisys.version
import qibuild.deps

class QiPackage(object):
    """ Binary package for use with qibuild.

    Package names are unique in a given toolchain.
    path is None until the package is added to a database

    """
    def __init__(self, name, version=None, path=None):
        self.name = name
        self.version = version
        self.target = None
        self.host = None
        self.path = path
        self.url = None
        self.directory = None
        self.toolchain_file = None
        self.sysroot = None
        self.cross_gdb = None
        self.build_depends = set()
        self.run_depends = set()
        self.test_depends = set()

    def load_deps(self):
        """ Parse package.xml, set the dependencies """
        package_xml = os.path.join(self.path, "package.xml")
        if os.path.exists(package_xml):
            xml_root = qisys.qixml.read(package_xml)
            qibuild.deps.read_deps_from_xml(self, xml_root)

    def install(self, destdir, components=None, release=True):
        """ Install the given components of the package to the given destination

        Will read

        * ``install_manifest_<component>.txt`` for each component if the file exists
        * ``<component>.mask`` to exclude files matching some regex if the mask exists
        * if none exits, will apply the ``qisys.sh.is_runtime`` filter when
          installing *runtime* component

        """<commit_msg>qitoolchain.qipackage.install: improve docstring<commit_after>## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
import os
import sys
import re
import zipfile

from qisys.qixml import etree
import qisys.version
import qibuild.deps

class QiPackage(object):
    """ Binary package for use with qibuild.

    Package names are unique in a given toolchain.
    path is None until the package is added to a database

    """
    def __init__(self, name, version=None, path=None):
        self.name = name
        self.version = version
        self.target = None
        self.host = None
        self.path = path
        self.url = None
        self.directory = None
        self.toolchain_file = None
        self.sysroot = None
        self.cross_gdb = None
        self.build_depends = set()
        self.run_depends = set()
        self.test_depends = set()

    def load_deps(self):
        """ Parse package.xml, set the dependencies """
        package_xml = os.path.join(self.path, "package.xml")
        if os.path.exists(package_xml):
            xml_root = qisys.qixml.read(package_xml)
            qibuild.deps.read_deps_from_xml(self, xml_root)

    def install(self, destdir, components=None, release=True):
        """ Install the given components of the package to the given destination

        Will read

        * ``install_manifest_<component>.txt`` for each component if the file exists
        * ``<component>.mask`` to exclude files matching some regex if the mask exists
        * if none exits, will apply the ``qisys.sh.is_runtime`` filter when
          installing *runtime* component

        Note that when installing 'test' component, only the
        install_manifest_test.txt manifest file will be read

        """
{'fraction_non_alphanumeric': 0.08375350140056022, 'fraction_numerical': 0.004481792717086834, 'mean_word_length': 2.60343087790111, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, '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': '5502362', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1000, 'n_words': 350}