Exemple #1
0
 def add_package(self, package: Package, rewrite=False) -> bool:
     full_dir = join(self.path, self.get_package_path(package, True))
     ensure_dir(full_dir)
     info('add ' + package.fullname)
     path = package.path
     LocalCache.__copy_data(rewrite, full_dir, path, 'ebin')
     LocalCache.__copy_include(rewrite, full_dir, path)
     if package.config.with_source:
         LocalCache.__copy_data(rewrite, full_dir, path, 'src')
     if package.config.with_source and package.has_nifs:
         LocalCache.__copy_data(rewrite, full_dir, path, 'c_src')
     if os.path.exists(join(path, 'priv')):
         LocalCache.__copy_data(rewrite, full_dir, path, 'priv')
     enot_package = join(path, package.name + '.ep')
     if not os.path.isfile(enot_package):
         debug('generate missing package')
         package.generate_package()
     copy_file(join(path, 'enot_config.json'),
               join(full_dir, 'enot_config.json'))
     copy_file(enot_package, join(full_dir, package.name + '.ep'))
     resource = resource_filename(Requirement.parse(enot.APPNAME),
                                  'enot/resources/EmptyMakefile')
     debug('copy ' + resource + ' to ' + join(full_dir, 'Makefile'))
     copy_file(resource, join(full_dir, 'Makefile'))
     package.path = full_dir  # update package's dir to point to cache
     return True
Exemple #2
0
 def unpackage(
     self, package: Package
 ):  # TODO move me to package? use current dir + <something> instead of temp
     unpack_dir = join(self.temp_dir, package.fullname)
     enotpack = join(package.path, package.name + '.ep')
     ensure_empty(unpack_dir)
     info('Extract ' + enotpack)
     with tarfile.open(enotpack) as pack:
         pack.extractall(unpack_dir)
     package.path = unpack_dir  # update path pointer
     copy_file(enotpack, join(unpack_dir, package.name + '.ep'))