rpm-spec-builddeps revision 3ce85a5f5264e7118beb6524e120fd8b53a13da4
13271N/A#!/usr/bin/env python
13271N/A#
13271N/A# Extract build dependencies from an RPM .spec file.
13271N/A#
13271N/A# Copyright (C) 2014 Red Hat
13271N/A#
13271N/A# This program is free software; you can redistribute it and/or modify
13271N/A# it under the terms of the GNU General Public License as published by
13271N/A# the Free Software Foundation; either version 3 of the License, or
13271N/A# (at your option) any later version.
13271N/A#
13271N/A# This program is distributed in the hope that it will be useful,
13271N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of
13271N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13271N/A# GNU General Public License for more details.
13271N/A#
13271N/A# You should have received a copy of the GNU General Public License
13271N/A# along with this program. If not, see <http://www.gnu.org/licenses/>.
13271N/A
13271N/Aimport sys
17719N/Aimport re
17719N/Aimport rpm
17719N/A
17719N/Adef usage(file):
17719N/A file.write(("Usage: %s SPEC\n" +
17719N/A "Extract build dependencies from an RPM .spec file.\n") %
13271N/A re.match(".*?([^/]+)$", sys.argv[0]).group(1))
13271N/A
13271N/Aif len(sys.argv) != 2:
13271N/A usage(sys.stderr)
13271N/A sys.exit(1)
13271N/A
13271N/Aspec = rpm.spec(sys.argv[1])
13271N/Afor d in rpm.ds(spec.sourceHeader, 'requires'):
13271N/A print d.DNEVR()[2:]
13271N/A