Coverage for python/lsst/verify/metadata/eupsmanifest.py : 26%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # See COPYRIGHT file at the top of the source tree. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <https://www.lsstcorp.org/LegalNotices/>. # """
['name', 'git_sha', 'version', 'dependencies'])
"""Iterator over packages in lsstsw's manifest.txt dataset.
Parameters ---------- manifest_stream : file handle A file handle for `manifest.txt` (from `open`, for example). """
self._build_id = None self._packages = OrderedDict()
self._parse_manifest_stream(manifest_stream)
for manifest_line in manifest_stream.readlines(): manifest_line = manifest_line.strip() if manifest_line.startswith('#'): continue elif manifest_line.startswith('BUILD'): self._build_id = manifest_line.split('=')[-1] continue parts = manifest_line.split() package_name = parts[0] git_commit = parts[1] eups_version = parts[2] if len(parts) == 4: deps = parts[3].split(',') else: deps = list()
package = ManifestItem( name=package_name, git_sha=git_commit, version=eups_version, dependencies=deps) self._packages[package_name] = package
"""Iterate over package names.
Yields ------ name : `str` Package name. """ for package in self._packages: yield package
"""Iterate over packages.
Yields ------ item : `tuple` Tuple of ``(name, manifest_item)``. ``manifest_item`` is a `ManifestItem` (namedtuple) type with fields:
- ``name`` - ``git_sha`` - ``version`` (EUPS version) - ``dependencies`` (list of EUPS package names) """ for item in self._packages.items(): yield item
"""Count number of packages in the manifest (`int`).""" return len(self._packages)
"""Get a package item from the manifest by name.
Parameters ---------- package_name : `str` EUPS package name.
Returns ------- item : `ManifestItem` `ManifestItem` is a `namedtuple` type with fields:
- ``name`` - ``git_sha`` - ``version`` (EUPS version) - ``dependencies`` (list of EUPS package names) """ return self._packages[package_name]
"""Test if a package is in the manifest.
Parameters ---------- package_name : `str` EUPS package name.
Returns ------- contained : `bool` `True` if package is in the manifest. """ return package_name in self._packages
def build(self): """Build number, bNNNN (`str`).""" return self._build_id |