def _check_package(pkg_xml, zipfilename, zf):
 uid = os.path.splitext(os.path.split(zipfilename)[1])[0]
 if (pkg_xml.get(u'id') != uid):
  raise ValueError((u'package identifier mismatch (%s vs %s)' % (pkg_xml.get(u'id'), uid)))
 if sum((((name != uid) and (not name.startswith((uid + u'/')))) for name in zf.namelist())):
  raise ValueError((u'Zipfile %s.zip does not expand to a single subdirectory %s/' % (uid, uid)))

def _check_package ( pkg_xml , zipfilename , zf ) : uid = os . path . splitext ( os . path . split ( zipfilename ) [ 1 ] ) [ 0 ] if ( pkg_xml . get ( u'id' ) != uid ) : raise ValueError ( ( u'package identifier mismatch (%s vs %s)' % ( pkg_xml . get ( u'id' ) , uid ) ) ) if sum ( ( ( ( name != uid ) and ( not name . startswith ( ( uid + u'/' ) ) ) ) for name in zf . namelist ( ) ) ) : raise ValueError ( ( u'Zipfile %s.zip does not expand to a single subdirectory %s/' % ( uid , uid ) ) )
helper for build_index(): perform some checks to make sure that the given package is consistent .