[Distutils] bug in svn detection

Keith Dart keith at dartworks.biz
Sun Aug 5 09:52:49 CEST 2007


Greetings. I would like to report a bug in setuptools here, since I
can't find a bug tracking system for it anywhere.

598 $ sudo python setup.py install
running install
running bdist_egg
 exceptions.ValueError : max() arg is an empty sequence
> /usr/lib/python2.4/site-packages/setuptools/command/egg_info.py(224) in get_svn_revision()
  localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]])
Debug:15/15> l
  214                      continue    # no sense walking uncontrolled subdirs
  215                  dirs.remove('.svn')
  216                  f = open(os.path.join(base,'.svn','entries'))
  217                  data = f.read()
  218                  f.close()
  219      
  220                  if data.startswith('8'):
  221                      data = map(str.splitlines,data.split('\n\x0c\n'))
  222                      del data[0][0]  # get rid of the '8'
  223                      dirurl = data[0][3]
  224  ->                  localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]])
  225                  elif data.startswith('<?xml'):
  226                      dirurl = urlre.search(data).group(1)    # get repository URL
  227                      localrev = max([int(m.group(1)) for m in revre.finditer(data)])
  228                  else:
  229                      log.warn("unrecognized .svn/entries format; skipping %s", base)
  230                      dirs[:] = []
  231                      continue
  232                  if base==os.curdir:
  233                      base_url = dirurl+'/'   # save the root url
  234                  elif not dirurl.startswith(base_url):
Debug:15/15> show
get_svn_revision (
           self = <setuptools.command.egg_info.egg_info instance at 0xb7b43f2c>,
  )
  Compiled locals:
                    files = ['mkpydocindex']
                    revre = <_sre.SRE_Pattern object at 0xb7cf4458>
                 base_url = 'https://pycopia.googlecode.com/svn/trunk/vim/'
                 localrev = 11
                 revision = 53
                     dirs = []
                     base = './bin'
                     data = [['', 'dir', '0', 'https://pycopia.googlecode.com/svn/trunk/vim/bin', 'https://pycopia.googlecode.com/svn', 'add', ...], ['mkpydocindex', 'file', '', '', '', 'add', ...], []]
                        d = []
                        f = <closed file './bin/.sv... mode 'r' at 0xb7c81530>
                        m = '*** undefined ***'
                     _[1] = '*** undefined ***'
                   dirurl = 'https://pycopia.googlecode.com/svn/trunk/vim/bin'
                    urlre = <_sre.SRE_Pattern object at 0xb7ba49a0>


601 !$ svn --version
svn, version 1.4.4 (r25188)
   compiled Jun 29 2007, 12:11:09

(However, the repository may have been created with an older version of subversion).

I guess Phillip would be most interested in this:

 51900 phillip.eby 
 51900 phillip.eby             if data.startswith('8'):
 51900 phillip.eby                 data = map(str.splitlines,data.split('\n\x0c\n'))
 51900 phillip.eby                 del data[0][0]  # get rid of the '8'
 51900 phillip.eby                 dirurl = data[0][3]
 56277 phillip.eby                 localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]]+[0])
 51900 phillip.eby             elif data.startswith('<?xml'):
 51900 phillip.eby                 dirurl = urlre.search(data).group(1)    # get repository URL
 56277 phillip.eby                 localrev = max([int(m.group(1)) for m in revre.finditer(data)]+[0])
 51900 phillip.eby             else:
 52009 phillip.eby                 log.warn("unrecognized .svn/entries format; skipping %s", base)
 51900 phillip.eby                 dirs[:] = []
 51900 phillip.eby                 continue


-- 

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Keith Dart <keith at dartworks.biz>
   public key: ID: 19017044
   <http://www.dartworks.biz/>
   =====================================================================


More information about the Distutils-SIG mailing list