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