Links

SourceDownloader

Downloading...
Apps can be distributed on various different services, websites, and other potential sources. RepositoryManager is designed to support an infinite amount of them. How does it do it?
A "SourceDownloader" is a simple Python file containing instructions for how to obtain an application from a given source, implementing an abstract class "BaseSourceDownloader". SourceDownloaders are stored in the "sources" directory, located in the server root, and are by all means actual source code that runs on the server, so be careful with them.
All SourceDownloaders contained in the "sources" directory are "installed sources" and imported by the server during repository indexing.
The following is an example of a SourceDownloader:
source_downloader.py.example
1
from sources.base_source_downloader import BaseSourceDownloader
2
3
4
class SourceDownloader(BaseSourceDownloader):
5
name = "Mysterious Source Downloader"
6
description = "Downloads a bunch of stuff from somewhere!!"
7
8
def __init__(self, oscmeta, temp_dir, log):
9
super().__init__(oscmeta, temp_dir, log)
10
# new fields should be defined here
11
# self.field_name = None
12
13
def fetch_source_information(self):
14
# Fetch source information for this source type
15
# AKA, set the newly created fields
16
pass
17
18
def process_files(self):
19
# Process files for this source type (it is mandatory to output an archive to self.archive_path)
20
# AKA, make use of the newly created fields
21
pass