fdroidserver.import_subcommand module

Extract application metadata from a source repository.

fdroidserver.import_subcommand.clone_to_tmp_dir(app: App, rev=None) Path

Clone the source repository of an app to a temporary directory for further processing.

Parameters:
app

The App instance to clone the source of.

Returns:
tmp_dir

The (temporary) directory the apps source has been cloned into.

fdroidserver.import_subcommand.get_all_gradle_and_manifests(build_dir)
fdroidserver.import_subcommand.get_app_from_url(url: str) App

Guess basic app metadata from the URL.

The URL must include a network hostname, unless it is an lp:, file:, or git/ssh URL. This throws ValueError on bad URLs to match urlparse().

Parameters:
url

The URL to look to look for app metadata at.

Returns:
app

App instance with the found metadata.

Raises:
FDroidException

If the VCS type could not be determined.

ValueError

If the URL is invalid.

fdroidserver.import_subcommand.get_gradle_subdir(build_dir, paths)

Get the subdir where the gradle build is based.

fdroidserver.import_subcommand.getrepofrompage(url: str) tuple[Optional[str], str]

Get the repo type and address from the given web page.

The page is scanned in a rather naive manner for ‘git clone xxxx’, ‘hg clone xxxx’, etc, and when one of these is found it’s assumed that’s the information we want. Returns repotype, address, or None, reason

Parameters:
url

The url to look for repository information at.

Returns:
repotype_or_none

The found repository type or None if an error occured.

address_or_reason

The address to the found repository or the reason if an error occured.

fdroidserver.import_subcommand.handle_retree_error_on_windows(function, path, excinfo)

Python can’t remove a readonly file on Windows so chmod first.

fdroidserver.import_subcommand.main()

Extract app metadata and write it to a file.

The behaviour of this function is influenced by the configuration file as well as command line parameters.

Raises:
FDroidException

If the repository already has local metadata, no URL is specified and the current directory is not a Git repository, no application ID could be found, no Gradle project could be found or there is already metadata for the found application ID.