original_docstring: Creates a .deb package. Simply adds the necessary DEBIAN directory in the temporary directory
      and substitute some values in files in this DEBIAN directory. No modification of the
      distribution is made.
docstring: Creates a .deb package. Simply adds the necessary DEBIAN directory in the temporary directory
  and substitute some values in files in this DEBIAN directory. No modification of the
  distribution is made.
docstring_tokens: Creates a . deb package . Simply adds the necessary DEBIAN directory in the temporary directory and substitute some values in files in this DEBIAN directory . No modification of the distribution is made .
code: def create_deb(pack_dir, install_prefix, version, gitrev, distro, arch, keep_temp = False):
      '''Creates a .deb package. Simply adds the necessary DEBIAN directory in the temporary directory
      and substitute some values in files in this DEBIAN directory. No modification of the
      distribution is made.'''
      global debian_dir, package_name
      (temp_dir, temp_dir_with_prefix) = create_dist(pack_dir, install_prefix, version, gitrev)
      temp_debian_dir = os.path.join(temp_dir, "DEBIAN")
      p4a_util.info("Copying " + debian_dir + " to " + temp_debian_dir)
      shutil.copytree(debian_dir, temp_debian_dir)
      control_file = os.path.join(temp_debian_dir, "control.tpl")
      (revision, versiond) = p4a_version.make_full_revision(custom_version = version, custom_gitrev = gitrev)
      subs_map = dict(NAME = package_name, VERSION = revision, ARCH = arch, DIST = "/" + install_prefix)
      p4a_util.info("Adjusting values in " + control_file)
      p4a_util.subs_template_file(control_file, subs_map)
      postinst_file = os.path.join(temp_debian_dir, "postinst.tpl")
      p4a_util.info("Adjusting values in " + postinst_file)
      p4a_util.subs_template_file(postinst_file, subs_map)
      package_file_name = package_name + "-" + revision + "_" + arch + ".deb"
      package_file = os.path.abspath(package_file_name)
      if os.path.exists(package_file):
          p4a_util.warn("Removing existing " + package_file)
          os.remove(package_file)
      p4a_util.run([ "fakeroot", "dpkg-deb", "--build", temp_dir, package_file_name ])
      if os.path.exists(package_file_name):
          p4a_util.done("Created " + package_file_name)
      else:
          p4a_util.warn(package_file_name + " file not created!?")
      if keep_temp:
          p4a_util.warn("Temporary directory was " + temp_dir)
      else:
          p4a_util.rmtree(temp_dir, can_fail = 1)
      return package_file_name
code_tokens: def create_deb ( pack_dir , install_prefix , version , gitrev , distro , arch , keep_temp = False ) : global debian_dir , package_name ( temp_dir , temp_dir_with_prefix ) = create_dist ( pack_dir , install_prefix , version , gitrev ) temp_debian_dir = os . path . join ( temp_dir , "DEBIAN" ) p4a_util . info ( "Copying " + debian_dir + " to " + temp_debian_dir ) shutil . copytree ( debian_dir , temp_debian_dir ) control_file = os . path . join ( temp_debian_dir , "control.tpl" ) ( revision , versiond ) = p4a_version . make_full_revision ( custom_version = version , custom_gitrev = gitrev ) subs_map = dict ( NAME = package_name , VERSION = revision , ARCH = arch , DIST = "/" + install_prefix ) p4a_util . info ( "Adjusting values in " + control_file ) p4a_util . subs_template_file ( control_file , subs_map ) postinst_file = os . path . join ( temp_debian_dir , "postinst.tpl" ) p4a_util . info ( "Adjusting values in " + postinst_file ) p4a_util . subs_template_file ( postinst_file , subs_map ) package_file_name = package_name + "-" + revision + "_" + arch + ".deb" package_file = os . path . abspath ( package_file_name ) if os . path . exists ( package_file ) : p4a_util . warn ( "Removing existing " + package_file ) os . remove ( package_file ) p4a_util . run ( [ "fakeroot" , "dpkg-deb" , "--build" , temp_dir , package_file_name ] ) if os . path . exists ( package_file_name ) : p4a_util . done ( "Created " + package_file_name ) else : p4a_util . warn ( package_file_name + " file not created!?" ) if keep_temp : p4a_util . warn ( "Temporary directory was " + temp_dir ) else : p4a_util . rmtree ( temp_dir , can_fail = 1 ) return package_file_name
short_docstring: Creates a .deb package.
short_docstring_tokens: Creates a . deb package .
comment: '''Creates a .deb package. Simply adds the necessary DEBIAN directory in the temporary directory
      and substitute some values in files in this DEBIAN directory. No modification of the
      distribution is made.'''