def main(): # Must create the repository location before we read in the configuration. repository_location = os.path.expanduser('~/example-repo') if not os.path.exists(repository_location): print("Creating the repository directory: %s" % repository_location) os.mkdir(repository_location) print("Populating repository with example data...") populate_repo(ALL_DISTS, repository_location) cfg_file_in = os.path.join(HERE, 'example.cfg.in') cfg_file = os.path.expanduser('~/example.cfg') with open(cfg_file, 'w') as out_file: with open(cfg_file_in, 'r') as in_file: out_file.write(in_file.read() % repository_location) print("Writing configuration: %s" % cfg_file) print("Reading configuration...") config = PkgMetaConfig.from_file(cfg_file) repo_config = config.get_repository_config() repo = Repository(repo_config) print("Loaded %s distributions into the repository" % len(repo)) print("-" * 80) print("You can now use the example data by supplying the pkgmeta script " "with the configuration file flag: -c ~/example.cfg")
def setUp(self): super(RepositoryTestCase, self).setUp() from pkgmeta.config import RepositoryConfig from pkgmeta.storage import FS_STORAGE_TYPE # Populate the repository with a single distribution populate_repo(ALL_DISTS, self.repo_directory) # Create the repository from a repository config self.config = RepositoryConfig('test', type=FS_STORAGE_TYPE, location=self.repo_directory)
def setUp(self): super(SubcommandTestCase, self).setUp() # Capture standard output self._orig_stdout = sys.stdout self.stdout = io.StringIO() sys.stdout = self.stdout # Repository configuration from pkgmeta.config import RepositoryConfig from pkgmeta.storage import FS_STORAGE_TYPE name = "test" location = self.repo_directory # Populate repository populate_repo(ALL_DISTS, self.repo_directory) self.repo_config = RepositoryConfig(name, type=FS_STORAGE_TYPE, location=location)
def setUp(self): super(TestReleaseSet, self).setUp() populate_repo([SOAPBAR], self.repo_directory)