Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:R:released
R2spec
spec.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File spec.diff of Package R2spec
--- r2spec/spec.py 2018-04-13 15:39:39.770282050 +0200 +++ r2spec/spec.py 2019-07-23 10:15:30.228758276 +0200 @@ -50,34 +50,53 @@ def format_dependencies(dependencies): """ Format the dependencies cleanning them as much as possible for rpm. """ - ignorelist = ['R'] - # Regular expression used to determine whether the string is a - # version number - versionmotif = re.compile('\d\.\d\.?\d?') - char = { - '\r': '', - '(': ' ', - ')': ' ', - ',': ' ', - ' ': ' ', - } - - for key in char.keys(): - dependencies = dependencies.replace(key, char[key]) - dep_list = [] - - for dep in dependencies.split(' '): - if dep.strip(): - if not ">" in dep \ - and not "<" in dep \ - and not "=" in dep \ - and len(versionmotif.findall(dep)) == 0 \ - and dep.strip() not in ignorelist: - dep = 'R-%s' % dep.strip() + + if dependencies == "": + return "" + else: + ignorelist = ['R'] + # Regular expression used to determine whether the string is a + # version number + versionmotif = re.compile('\d\.\d\.?\d?') + char = { + '\r': '', + '(': ' ', + ')': ' ', + ' ': ' ', + ' ,': ',' + } + + for key in char.keys(): + dependencies = dependencies.replace(key, char[key]) + dep_list = [] + + for dep in dependencies.split(', '): + depcomp = dep.split(' ') + if depcomp[0] not in ignorelist: + depcomp[0] = 'R-%s' % depcomp[0].strip() + dep = ' '.join(depcomp).strip() dep_list.append(dep) + + return ', '.join(dep_list).strip() - return ' '.join(dep_list).strip() - +def format_forbuild(dependencies): + """ Format the dependencies for Build-Requires (i.e. add -devel when needed) + """ + # A list of packages having a devel version + devlist = ['R-Matrix', 'R-RInside', 'R-Rcpp', 'R-RcppArmadillo', 'R-RcppCCTZ', 'R-RcppEigen', 'R-RcppParallel', 'R-base', 'R-core', 'R-digest', 'R-gaston', 'R-later', 'R-mvtnorm', 'R-preprocessCore', 'R-rgdal', 'R-sourcetools', 'R-sp', 'R-stringi', 'R-testthat'] + dep_list = [] + + if dependencies == "": + return "" + else: + for dep in dependencies.split(', '): + depcomp = dep.split(' ') + if depcomp[0] in devlist: + depcomp[0] = '%s-devel' % depcomp[0].strip() + dep = ' '.join(depcomp).strip() + dep_list.append(dep) + + return ', '.join(dep_list).strip() class Spec: """ @@ -159,8 +178,19 @@ self.__dict['source0'] = self.package.source0 self.__dict['depends'] = format_dependencies( self.package.get('Depends')) + self.__dict['dependsbuild'] = format_dependencies( + self.package.get('Depends')) + self.__dict['dependsbuild'] = format_forbuild(self.__dict['dependsbuild']) self.__dict['imports'] = format_dependencies( self.package.get('Imports')) + self.__dict['importsbuild'] = format_dependencies( + self.package.get('Imports')) + self.__dict['importsbuild'] = format_forbuild(self.__dict['importsbuild']) + self.__dict['linkingto'] = format_dependencies( + self.package.get('LinkingTo')) + self.__dict['linkingtobuild'] = format_dependencies( + self.package.get('LinkingTo')) + self.__dict['linkingtobuild'] = format_forbuild(self.__dict['linkingtobuild']) if not self.no_suggest: self.__dict['suggests'] = format_dependencies( self.package.get('Suggests'))
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor