summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/bdist_rpm.py145
1 files changed, 3 insertions, 142 deletions
diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py
index b09b657..d37d609 100644
--- a/Lib/distutils/command/bdist_rpm.py
+++ b/Lib/distutils/command/bdist_rpm.py
@@ -318,73 +318,6 @@ class bdist_rpm (Command):
# run()
- def _get_package_data(self):
- ''' Get data needed to generate spec file, first from the
- DistributionMetadata class, then from the package_data file, which is
- Python code read with execfile() '''
-
- from string import join
-
- package_type = 'rpm'
-
- # read in package data, if any
- if os.path.exists('package_data'):
- try:
- exec(open('package_data'))
- except:
- raise DistutilsOptionError, 'Unable to parse package data file'
-
- # set instance variables, supplying default value if not provided in
- # package data file
- self.package_data = locals()
-
- # the following variables must be {string (len() = 2): string}
- self.summaries = self._check_string_dict('summaries')
- self.descriptions = self._check_string_dict('descriptions')
-
- # The following variable must be an ordinary number or a string
- self.release = self._check_number_or_string('release', '1')
- self.serial = self._check_number_or_string('serial')
-
- # The following variables must be strings
- self.group = self._check_string('group', 'Development/Libraries')
- self.vendor = self._check_string('vendor')
- self.packager = self._check_string('packager')
- self.changelog = self._check_string('changelog')
- self.icon = self._check_string('icon')
- self.distribution_name = self._check_string('distribution_name')
- self.pre = self._check_string('pre')
- self.post = self._check_string('post')
- self.preun = self._check_string('preun')
- self.postun = self._check_string('postun')
- self.prep = self._check_string('prep', '%setup')
- if self.use_rpm_opt_flags:
- self.build = (self._check_string(
- 'build',
- 'env CFLAGS="$RPM_OPT_FLAGS" python setup.py build'))
- else:
- self.build = (self._check_string('build', 'python setup.py build'))
- self.install = self._check_string(
- 'install',
- 'python setup.py install --root=$RPM_BUILD_ROOT --record')
- self.clean = self._check_string(
- 'clean',
- 'rm -rf $RPM_BUILD_ROOT')
-
- # The following variables must be a list or tuple of strings, or a
- # string
- self.doc = self._check_string_list('doc')
- if type(self.doc) == ListType:
- for readme in ('README', 'README.txt'):
- if os.path.exists(readme) and readme not in self.doc:
- self.doc.append(readme)
- self.doc = join(self.doc)
- self.provides = join(self._check_string_list('provides'))
- self.requires = join(self._check_string_list('requires'))
- self.conflicts = join(self._check_string_list('conflicts'))
- self.build_requires = join(self._check_string_list('build_requires'))
- self.obsoletes = join(self._check_string_list('obsoletes'))
-
def _make_spec_file(self):
"""Generate the text of an RPM spec file and return it as a
list of strings (one per line).
@@ -512,78 +445,6 @@ class bdist_rpm (Command):
return spec_file
- def _check_string_dict(self, var_name, default_value = {}):
- ''' Tests a wariable to determine if it is {string: string},
- var_name is the name of the wariable. Return the value if it is valid,
- returns default_value if the variable does not exist, raises
- DistutilsOptionError if the variable is not valid'''
- if self.package_data.has_key(var_name):
- pass_test = 1 # set to 0 if fails test
- value = self.package_data[var_name]
- if type(value) == DictType:
- for locale in value.keys():
- if (type(locale) != StringType) or (type(value[locale]) !=
- StringType):
- pass_test = 0
- break
- if pass_test:
- return test_me
- raise DistutilsOptionError, \
- ("Error in package_data: '%s' must be dictionary: "
- '{string: string}' % var_name)
- else:
- return default_value
-
- def _check_string(self, var_name, default_value = None):
- ''' Tests a variable in package_data to determine if it is a string,
- var_name is the name of the wariable. Return the value if it is a
- string, returns default_value if the variable does not exist, raises
- DistutilsOptionError if the variable is not a string'''
- if self.package_data.has_key(var_name):
- if type(self.package_data[var_name]) == StringType:
- return self.package_data[var_name]
- else:
- raise DistutilsOptionError, \
- "Error in package_data: '%s' must be a string" % var_name
- else:
- return default_value
-
- def _check_number_or_string(self, var_name, default_value = None):
- ''' Tests a variable in package_data to determine if it is a number or
- a string, var_name is the name of the wariable. Return the value if it
- is valid, returns default_value if the variable does not exist, raises
- DistutilsOptionError if the variable is not valid'''
- if self.package_data.has_key(var_name):
- if type(self.package_data[var_name]) in (StringType, LongType,
- IntType, FloatType):
- return str(self.package_data[var_name])
- else:
- raise DistutilsOptionError, \
- ("Error in package_data: '%s' must be a string or a "
- 'number' % var_name)
- else:
- return default_value
-
- def _check_string_list(self, var_name, default_value = []):
- ''' Tests a variable in package_data to determine if it is a string or
- a list or tuple of strings, var_name is the name of the wariable.
- Return the value as a string or a list if it is valid, returns
- default_value if the variable does not exist, raises
- DistutilsOptionError if the variable is not valid'''
- if self.package_data.has_key(var_name):
- value = self.package_data[var_name]
- pass_test = 1
- if type(value) == StringType:
- return value
- elif type(value) in (ListType, TupleType):
- for item in value:
- if type(item) != StringType:
- pass_test = 0
- break
- if pass_test:
- return list(value)
- raise DistutilsOptionError, \
- ("Error in package_data: '%s' must be a string or a "
- 'list or tuple of strings' % var_name)
- else:
- return default_value
+ # _make_spec_file ()
+
+# class bdist_rpm