2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								"""distutils.command.bdist_rpm
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Implements the Distutils 'bdist_rpm' command (create RPM source and binary
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-27 17:27:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								distributions)."""
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-11-10 22:23:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# This module should be kept compatible with Python 2.1.
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-19 13:12:28 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								__revision__ = "$Id$"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import sys, os, string
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import glob
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-27 17:27:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from types import *
							 | 
						
					
						
							
								
									
										
										
										
											2002-09-11 16:31:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from distutils.core import Command
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from distutils.debug import DEBUG
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-05 01:31:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from distutils.util import get_platform
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from distutils.file_util import write_file
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from distutils.errors import *
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-23 18:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from distutils.sysconfig import get_python_version
							 | 
						
					
						
							
								
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from distutils import log
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class bdist_rpm (Command):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    description = "create an RPM distribution"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    user_options = [
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:30:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('bdist-base=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "base directory for creating built distributions"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:30:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('rpm-base=', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "base directory for creating RPMs (defaults to \"rpm\" under "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "--bdist-base; must be specified for RPM 2)"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('dist-dir=', 'd',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "directory to put final RPM files in "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "(and .spec files if --spec-only)"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('python=', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "path to Python interpreter to hard-code in the .spec file "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "(default: \"python\")"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('fix-python', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "hard-code the exact path to the current Python interpreter in "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "the .spec file"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('spec-only', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "only regenerate spec file"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('source-only', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "only generate source RPM"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('binary-only', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "only generate binary RPM"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('use-bzip2', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "use bzip2 instead of gzip to create source distribution"),
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # More meta-data: too RPM-specific to put in the setup script,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # but needs to go in the .spec file -- so we make these options
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # to "bdist_rpm".  The idea is that packagers would put this
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # info in setup.cfg, although they are of course free to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # supply it on the command line.
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('distribution-name=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-07 02:38:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "name of the (Linux) distribution to which this "
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "RPM applies (*not* the name of the module distribution!)"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('group=', None,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "package classification [default: \"Development/Libraries\"]"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('release=', None,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "RPM release number"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('serial=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "RPM serial number"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('vendor=', None,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "RPM \"vendor\" (eg. \"Joe Blow <joe@example.com>\") "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "[default: maintainer or author from setup script]"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('packager=', None,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "RPM packager (eg. \"Jane Doe <jane@example.net>\")"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "[default: vendor]"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('doc-files=', None,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "list of documentation files (space or comma-separated)"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('changelog=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-04 13:33:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "RPM changelog"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('icon=', None,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "name of icon file"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('provides=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "capabilities provided by this package"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('requires=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "capabilities required by this package"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('conflicts=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "capabilities which conflict with this package"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('build-requires=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "capabilities required to build this package"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:53:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('obsoletes=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "capabilities made obsolete by this package"),
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-17 08:34:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('no-autoreq', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "do not automatically calculate dependencies"),
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # Actions to take when building RPM
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-16 15:54:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('keep-temp', 'k',
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "don't clean up RPM build directory"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-16 15:54:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('no-keep-temp', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "clean up RPM build directory [default]"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('use-rpm-opt-flags', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "compile with RPM_OPT_FLAGS when building from source RPM"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('no-rpm-opt-flags', None,
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "do not pass any RPM CFLAGS to compiler"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('rpm3-mode', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "RPM 3 compatibility mode (default)"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('rpm2-mode', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "RPM 2 compatibility mode"),
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # Add the hooks necessary for specifying custom scripts
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('prep-script=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the PREP phase of RPM building"),
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('build-script=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the BUILD phase of RPM building"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('pre-install=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the pre-INSTALL phase of RPM building"),
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('install-script=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the INSTALL phase of RPM building"),
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('post-install=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the post-INSTALL phase of RPM building"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('pre-uninstall=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the pre-UNINSTALL phase of RPM building"),
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('post-uninstall=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the post-UNINSTALL phase of RPM building"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-12 03:49:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ('clean-script=', None,
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:25:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the CLEAN phase of RPM building"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('verify-script=', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "Specify a script for the VERIFY phase of the RPM build"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:32:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # Allow a packager to explicitly force an architecture
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ('force-arch=', None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         "Force an architecture onto the RPM build process"),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       ]
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-17 08:34:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    boolean_options = ['keep-temp', 'use-rpm-opt-flags', 'rpm3-mode',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                       'no-autoreq']
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-25 01:41:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-16 15:54:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    negative_opt = {'no-keep-temp': 'keep-temp',
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    'no-rpm-opt-flags': 'use-rpm-opt-flags',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    'rpm2-mode': 'rpm3-mode'}
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    def initialize_options (self):
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.bdist_base = None
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:30:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.rpm_base = None
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.dist_dir = None
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.python = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.fix_python = None
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.spec_only = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.binary_only = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.source_only = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.use_bzip2 = None
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.distribution_name = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.group = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.release = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.serial = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.vendor = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.packager = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.doc_files = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.changelog = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.icon = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.prep_script = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.build_script = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.install_script = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.clean_script = None
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-06 18:44:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.verify_script = None
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.pre_install = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.post_install = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.pre_uninstall = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.post_uninstall = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.prep = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.provides = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.requires = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.conflicts = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.build_requires = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.obsoletes = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-16 15:54:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.keep_temp = 0
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.use_rpm_opt_flags = 1
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.rpm3_mode = 1
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-17 08:34:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.no_autoreq = 0
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:32:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.force_arch = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # initialize_options()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    def finalize_options (self):
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:30:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if self.rpm_base is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            if not self.rpm3_mode:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                raise DistutilsOptionError, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      "you must specify --rpm-base in RPM 2 mode"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            self.rpm_base = os.path.join(self.bdist_base, "rpm")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if self.python is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            if self.fix_python:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                self.python = sys.executable
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                self.python = "python"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        elif self.fix_python:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            raise DistutilsOptionError, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  "--python and --fix-python are mutually exclusive options"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if os.name != 'posix':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            raise DistutilsPlatformError, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  ("don't know how to create RPM "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                   "distributions on platform %s" % os.name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.binary_only and self.source_only:
							 | 
						
					
						
							
								
									
										
										
										
											2001-08-10 19:00:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            raise DistutilsOptionError, \
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                  "cannot supply both '--source-only' and '--binary-only'"
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # don't pass CFLAGS to pure python distributions
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if not self.distribution.has_ext_modules():
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-31 23:56:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            self.use_rpm_opt_flags = 0
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.finalize_package_data()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # finalize_options()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    def finalize_package_data (self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('group', "Development/Libraries")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('vendor',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                           "%s <%s>" % (self.distribution.get_contact(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                        self.distribution.get_contact_email()))
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('packager')
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string_list('doc_files')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if type(self.doc_files) is ListType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            for readme in ('README', 'README.txt'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if os.path.exists(readme) and readme not in self.doc_files:
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-21 20:34:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    self.doc_files.append(readme)
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('release', "1")
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('serial')   # should it be an int?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('distribution_name')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('changelog')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          # Format changelog correctly
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.changelog = self._format_changelog(self.changelog)
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('icon')
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('prep_script')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('build_script')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('install_script')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('clean_script')
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-06 18:44:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('verify_script')
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('pre_install')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('post_install')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('pre_uninstall')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_filename('post_uninstall')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # XXX don't forget we punted on summaries and descriptions -- they
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # should be handled here eventually!
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # Now *this* is some meta-data that belongs in the setup script...
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string_list('provides')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string_list('requires')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string_list('conflicts')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string_list('build_requires')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string_list('obsoletes')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:32:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.ensure_string('force_arch')
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # finalize_package_data ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    def run (self):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-02 02:01:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if DEBUG:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            print "before _get_package_data():"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            print "vendor =", self.vendor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            print "packager =", self.packager
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            print "doc_files =", self.doc_files
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            print "changelog =", self.changelog
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # make directories
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.spec_only:
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            spec_dir = self.dist_dir
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            self.mkpath(spec_dir)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else:
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rpm_dir = {}
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-27 17:27:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'):
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:30:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                rpm_dir[d] = os.path.join(self.rpm_base, d)
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                self.mkpath(rpm_dir[d])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_dir = rpm_dir['SPECS']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # Spec file goes into 'dist_dir' if '--spec-only specified',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # build/rpm.<plat> otherwise.
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        spec_path = os.path.join(spec_dir,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                 "%s.spec" % self.distribution.get_name())
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.execute(write_file,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     (spec_path,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      self._make_spec_file()),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                     "writing '%s'" % spec_path)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.spec_only: # stop if requested
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # Make a source distribution and copy to SOURCES directory with
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # optional icon.
							 | 
						
					
						
							
								
									
										
										
										
											2005-04-15 06:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        saved_dist_files = self.distribution.dist_files[:]
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-30 18:27:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        sdist = self.reinitialize_command('sdist')
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.use_bzip2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            sdist.formats = ['bztar']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            sdist.formats = ['gztar']
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-27 17:27:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.run_command('sdist')
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-21 20:56:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        self.distribution.dist_files = saved_dist_files
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        source = sdist.get_archive_files()[0]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        source_dir = rpm_dir['SOURCES']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.copy_file(source, source_dir)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.icon:
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-27 17:27:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            if os.path.exists(self.icon):
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                self.copy_file(self.icon, source_dir)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                raise DistutilsFileError, \
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-01 00:40:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                      "icon file '%s' does not exist" % self.icon
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # build package
							 | 
						
					
						
							
								
									
										
										
										
											2002-06-04 20:14:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        log.info("building RPMs")
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        rpm_cmd = ['rpm']
							 | 
						
					
						
							
								
									
										
										
										
											2002-10-07 05:57:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if os.path.exists('/usr/bin/rpmbuild') or \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           os.path.exists('/bin/rpmbuild'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rpm_cmd = ['rpmbuild']
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.source_only: # what kind of RPMs?
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rpm_cmd.append('-bs')
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        elif self.binary_only:
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rpm_cmd.append('-bb')
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else:
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rpm_cmd.append('-ba')
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if self.rpm3_mode:
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rpm_cmd.extend(['--define',
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-17 08:23:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                             '_topdir %s' % os.path.abspath(self.rpm_base)])
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-16 15:54:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if not self.keep_temp:
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rpm_cmd.append('--clean')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        rpm_cmd.append(spec_path)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        self.spawn(rpm_cmd)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:03:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # XXX this is a nasty hack -- we really should have a proper way to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # find out the names of the RPM files created; also, this assumes
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # that RPM creates exactly one source and one binary RPM.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if not self.dry_run:
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:05:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            if not self.binary_only:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                srpms = glob.glob(os.path.join(rpm_dir['SRPMS'], "*.rpm"))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                assert len(srpms) == 1, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                       "unexpected number of SRPM files found: %s" % srpms
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-23 22:16:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                dist_file = ('bdist_rpm', 'any',
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-24 07:00:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                             self._dist_path(srpms[0]))
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-23 18:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                self.distribution.dist_files.append(dist_file)
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:05:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                self.move_file(srpms[0], self.dist_dir)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            if not self.source_only:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm"))
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-24 07:00:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                debuginfo = glob.glob(os.path.join(rpm_dir['RPMS'],
							 | 
						
					
						
							
								
									
										
										
										
											2004-06-11 17:16:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                   "*/*debuginfo*.rpm"))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if debuginfo:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    rpms.remove(debuginfo[0])
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:05:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                assert len(rpms) == 1, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                       "unexpected number of RPM files found: %s" % rpms
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-23 18:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                dist_file = ('bdist_rpm', get_python_version(),
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-28 01:05:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                             self._dist_path(rpms[0]))
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-23 18:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                self.distribution.dist_files.append(dist_file)
							 | 
						
					
						
							
								
									
										
										
										
											2000-08-15 13:05:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                self.move_file(rpms[0], self.dist_dir)
							 | 
						
					
						
							
								
									
										
										
										
											2004-06-11 17:16:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                if debuginfo:
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-23 18:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    dist_file = ('bdist_rpm', get_python_version(),
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-28 01:05:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                 self._dist_path(debuginfo[0]))
							 | 
						
					
						
							
								
									
										
										
										
											2004-06-11 17:16:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    self.move_file(debuginfo[0], self.dist_dir)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # run()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2005-03-24 07:00:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    def _dist_path(self, path):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return os.path.join(self.dist_dir, os.path.basename(path))
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    def _make_spec_file(self):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        """Generate the text of an RPM spec file and return it as a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        list of strings (one per line).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # definitions and headers
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        spec_file = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '%define name ' + self.distribution.get_name(),
							 | 
						
					
						
							
								
									
										
										
										
											2004-08-25 13:04:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            '%define version ' + self.distribution.get_version().replace('-','_'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '%define release ' + self.release.replace('-','_'),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            'Summary: ' + self.distribution.get_description(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # put locale summaries into spec file
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # XXX not supported for now (hard to put a dictionary
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # in a config file -- arg!)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #for locale in self.summaries.keys():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #    spec_file.append('Summary(%s): %s' % (locale,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #                                          self.summaries[locale]))
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        spec_file.extend([
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            'Name: %{name}',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            'Version: %{version}',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            'Release: %{release}',])
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # XXX yuck! this filename is available from the "sdist" command,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # but only after it has run: and we create the spec file before
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # running "sdist", in case of --spec-only.
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.use_bzip2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('Source0: %{name}-%{version}.tar.bz2')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('Source0: %{name}-%{version}.tar.gz')
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        spec_file.extend([
							 | 
						
					
						
							
								
									
										
										
										
											2002-07-28 10:49:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            'License: ' + self.distribution.get_license(),
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            'Group: ' + self.group,
							 | 
						
					
						
							
								
									
										
										
										
											2004-08-25 13:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            'BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot',
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            'Prefix: %{_prefix}', ])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-10 06:32:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if not self.force_arch:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            # noarch if no extension modules
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            if not self.distribution.has_ext_modules():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                spec_file.append('BuildArch: noarch')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.append( 'BuildArch: %s' % self.force_arch )
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        for field in ('Vendor',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      'Packager',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      'Provides',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      'Requires',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      'Conflicts',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      'Obsoletes',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      ):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            val = getattr(self, string.lower(field))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            if type(val) is ListType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                spec_file.append('%s: %s' % (field, string.join(val)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            elif val is not None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                spec_file.append('%s: %s' % (field, val))
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.distribution.get_url() != 'UNKNOWN':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('Url: ' + self.distribution.get_url())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.distribution_name:
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('Distribution: ' + self.distribution_name)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.build_requires:
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('BuildRequires: ' +
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             string.join(self.build_requires))
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.icon:
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-27 17:27:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('Icon: ' + os.path.basename(self.icon))
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2004-09-17 08:34:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if self.no_autoreq:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('AutoReq: 0')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        spec_file.extend([
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '%description',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            self.distribution.get_long_description()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # put locale descriptions into spec file
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # XXX again, suppressed because config file syntax doesn't
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # easily support this ;-(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #for locale in self.descriptions.keys():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #    spec_file.extend([
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #        '',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #        '%description -l ' + locale,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #        self.descriptions[locale],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        #        ])
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # rpm scripts
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # figure out default build script
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        def_build = "%s setup.py build" % self.python
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if self.use_rpm_opt_flags:
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # insert contents of files
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # XXX this is kind of misleading: user-supplied options are files
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # that we open and interpolate into the spec file, but the defaults
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # are just text that we drop in as-is.  Hmmm.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        script_options = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ('prep', 'prep_script', "%setup"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ('build', 'build_script', def_build),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ('install', 'install_script',
							 | 
						
					
						
							
								
									
										
										
										
											2000-09-10 01:21:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             ("%s setup.py install "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              "--root=$RPM_BUILD_ROOT "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              "--record=INSTALLED_FILES") % self.python),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"),
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-06 18:44:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ('verifyscript', 'verify_script', None),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ('pre', 'pre_install', None),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ('post', 'post_install', None),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ('preun', 'pre_uninstall', None),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:30:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ('postun', 'post_uninstall', None),
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        for (rpm_opt, attr, default) in script_options:
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-08 15:11:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            # Insert contents of file referred to, if no file is referred to
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            # use 'default' as contents of script
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            val = getattr(self, attr)
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            if val or default:
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                spec_file.extend([
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    '',
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    '%' + rpm_opt,])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if val:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    spec_file.extend(string.split(open(val, 'r').read(), '\n'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    spec_file.append(default)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # files section
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        spec_file.extend([
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '%files -f INSTALLED_FILES',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '%defattr(-,root,root)',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fairly massive overhaul to support getting RPM inputs (extra meta-data,
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file.  (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
  * added a boatload of options to 'user_options' and
    'initialize_options()': 'distribution_name', 'group', 'release', ...
  * added 'finalize_package_data()', which takes the place of
    '_get_package_data()' -- except it's called from 'finalize_options()',
    not 'run()', so we have everything figured out before we actually run
    the command
  * added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
    these take the place of '_check_string()' and friends.  (These actually
    look like really useful type-checking methods that could come in handy
    all over the Distutils; should consider moving them up to Command and
    using them in other command classes' 'finalize_options()' method for
    error-checking).
  * various cleanup, commentary, and adaptation to the new way of
    storing RPM info in '_make_spec_file()'
											
										 
										
											2000-06-02 01:49:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if self.doc_files:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.append('%doc ' + string.join(self.doc_files))
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if self.changelog:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.extend([
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                '',
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                '%changelog',])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            spec_file.extend(self.changelog)
							 | 
						
					
						
							
								
									
										
										
										
											2000-05-13 03:11:40 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return spec_file
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-02 01:52:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # _make_spec_file ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    def _format_changelog(self, changelog):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        """Format the changelog correctly and convert it to a list of strings
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        """
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-08 14:21:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if not changelog:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            return changelog
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        new_changelog = []
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        for line in string.split(string.strip(changelog), '\n'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            line = string.strip(line)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            if line[0] == '*':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                new_changelog.extend(['', line])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            elif line[0] == '-':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                new_changelog.append(line)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                new_changelog.append('  ' + line)
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        # strip trailing newline inserted by first changelog entry
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if not new_changelog[0]:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            del new_changelog[0]
							 | 
						
					
						
							
								
									
										
										
										
											2001-12-06 21:01:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-04 15:00:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return new_changelog
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # _format_changelog()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2000-06-02 01:52:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# class bdist_rpm
							 |