@util.positional(1)
def generate_file_descriptor(dest_dir, file_descriptor, force_overwrite):
 package = file_descriptor.package
 if (not package):
  logging.warn('Will not generate descriptor without package name')
  return
 if (package in EXCLUDED_PACKAGES):
  logging.warn(('Will not generate main ProtoRPC class %s' % package))
  return
 package_path = package.split('.')
 directory = package_path[:(-1)]
 package_file_name = package_path[(-1)]
 directory_name = os.path.join(dest_dir, *directory)
 output_file_name = os.path.join(directory_name, ('%s.py' % (package_file_name,)))
 try:
  os.makedirs(directory_name)
 except OSError as err:
  if (err.errno != errno.EEXIST):
   raise
 if ((not force_overwrite) and os.path.exists(output_file_name)):
  logging.warn('Not overwriting %s with package %s', output_file_name, package)
  return
 output_file = open(output_file_name, 'w')
 logging.info('Writing package %s to %s', file_descriptor.package, output_file_name)
 generate_python.format_python_file(file_descriptor, output_file)

@ util . positional ( 1 ) def generate_file_descriptor ( dest_dir , file_descriptor , force_overwrite ) : package = file_descriptor . package if ( not package ) : logging . warn ( 'Will not generate descriptor without package name' ) return if ( package in EXCLUDED_PACKAGES ) : logging . warn ( ( 'Will not generate main ProtoRPC class %s' % package ) ) return package_path = package . split ( '.' ) directory = package_path [ : ( - 1 ) ] package_file_name = package_path [ ( - 1 ) ] directory_name = os . path . join ( dest_dir , * directory ) output_file_name = os . path . join ( directory_name , ( '%s.py' % ( package_file_name , ) ) ) try : os . makedirs ( directory_name ) except OSError as err : if ( err . errno != errno . EEXIST ) : raise if ( ( not force_overwrite ) and os . path . exists ( output_file_name ) ) : logging . warn ( 'Not overwriting %s with package %s' , output_file_name , package ) return output_file = open ( output_file_name , 'w' ) logging . info ( 'Writing package %s to %s' , file_descriptor . package , output_file_name ) generate_python . format_python_file ( file_descriptor , output_file )
generate a single file descriptor to destination directory .