def __create_package(self, package_name,
                         DisplayName,
                         Description,
                         Version,
                         ReleaseDate,
                         Name,
                         Virtual=None,
                         SortingPriority=None,
                         Default=None):  # pylint: disable=C0103

        path = "%s/packages/%s" % (self.folder, package_name)
        self.__mkdir(path)
        self.__mkdir("%s/meta" % path)

        script = self.configuration.script_by_name(package_name)
        if script is not None:
            src = "%s/%s" % (Paths.BVI_SHARE_SCRIPTS, script)
            dst = "%s/meta/script.qs" % path
            shutil.copyfile(src, dst)
            script = "script.qs"

        package = IFWPackage(
            DisplayName=DisplayName,
            Description=Description,
            Version=Version,
            ReleaseDate=ReleaseDate,
            Name=Name,
            Script=script,
            Virtual=Virtual,
            SortingPriority=SortingPriority,
            Default=Default)

        package.save("%s/meta/package.xml" % path)
Example #2
0
    def ifwpackage(self):
        tag_deps = list()
        if self.dependencies:
            for dep_pack in self.dependencies:
                tag_dep = TagDependency(
                    name=dep_pack.ifwname,
                    version=self.make_valid_version(dep_pack.version))
                tag_deps.append(tag_dep)
        if self.type == 'run':
            tag_deps.append(TagDependency(
                name="brainvisa.app.thirdparty.bv_env"))
        if self.licenses:
            for lic in self.licenses:
                valid_name = ft.ifw_name(lic)
                license_component = "brainvisa.app.licenses.%s" % valid_name
                tag_dep = TagDependency(name=license_component)
                tag_deps.append(tag_dep)

        package = IFWPackage(
            DisplayName=self.displayname,
            Description=self.description,
            Version=self.make_valid_version(self.version),
            ReleaseDate=self.date,
            Name=self.ifwname,
            TagDependencies=tag_deps,
            Virtual=self.virtual,
            Script=self.script,
            TagLicenses=None,
            Default=self.default)
        return package
Example #3
0
 def ifwpackage(self):
     package = IFWPackage(DisplayName=self.name.title(),
                          Description=self.description,
                          Version=self.version,
                          ReleaseDate=self.date,
                          Name=self.ifwname,
                          Script=self.script,
                          Virtual='false')
     return package
Example #4
0
 def ifwpackage(self):
     package = IFWPackage(
         DisplayName=self.name,
         Description='',
         Version=self.version,
         ReleaseDate=self.date,
         Name=self.ifwname,
         Virtual='true',
         TagLicenses=self.licenses)
     return package
Example #5
0
def test_utils_IFWPackage_2():
    x = IFWPackage(DisplayName='DisplayName 0x38434', Virtual='true')
    x.save(OUTPUT)
    assert os.path.isfile(OUTPUT)
    del x
    x = XmlFile()
    x.read(OUTPUT)
    assert x.root.find('DisplayName').text == 'DisplayName 0x38434'
    assert x.root.find('Virtual').text == 'true'
Example #6
0
def test_utils_IFWPackage():
    x = IFWPackage(
        DisplayName='DisplayName 0x234',
        Description='Description 0x899',
        Version='Version 0x333',
        ReleaseDate='ReleaseDate 0x893',
        Name='Name 0x689',
        TagDependencies=(TagDependency(name='Name 0x928',
                                       version='Version 0xF3E',
                                       comparison='Comparison 0x288'),
                         TagDependency(name='Name 0x192',
                                       version='Version 0x111',
                                       comparison='Comparison 0x112'),
                         TagDependency(name='Name 0x109',
                                       version='Version 0x128',
                                       comparison='Comparison 0x666')),
        AutoDependOn='AutoDependOn 0x668',
        Virtual='Virtual 0x655',
        SortingPriority='SortingPriority 0x234',
        TagLicenses=(TagLicense(name='Name 0x23F', file_='File 0x11F'),
                     TagLicense(name='Name 0x897', file_='File 0x121'),
                     TagLicense(name='Name 0x122', file_='File 0x001')),
        Script='Script 0x273',
        UserInterfaces=[
            'UserInterfaces 0x6721', 'UserInterfaces 0x6722',
            'UserInterfaces 0x6723'
        ],
        Translations=[
            'Translations 0x653', 'Translations 0x643', 'Translations 0x652'
        ],
        UpdateText='UpdateText 0x672',
        Default='Default 0x772',
        Essential='Essential 0x628',
        ForcedInstallation='ForcedInstallation 0x287',
        Replaces='Replaces 0x577',
        DownloadableArchives='Replaces 0x579')
    x.save(OUTPUT)
    assert os.path.isfile(OUTPUT)
    del x
    x = XmlFile()
    x.read(OUTPUT)
    assert x.root.find('Description').text == 'Description 0x899'
    assert x.root.find('ReleaseDate').text == 'ReleaseDate 0x893'
    assert x.root.find('SortingPriority').text == 'SortingPriority 0x234'
    assert x.root.find('Essential').text == 'Essential 0x628'
    assert x.root.find('Script').text == 'Script 0x273'
    assert x.root.find(
        'Dependencies'
    ).text == 'Name0x928-Comparison0x288Version0xF3E, Name0x192-Comparison0x112Version0x111, Name0x109-Comparison0x666Version0x128'
    assert x.root.find('Licenses')[0].attrib['file'] == 'File 0x11F'
    assert x.root.find('Licenses')[2].attrib['name'] == 'Name 0x122'
    assert x.root.find('UserInterfaces')[1].text == 'UserInterfaces 0x6722'
    assert x.root.find('Virtual') == None
Example #7
0
 def __create_subcategory(self, folder):
     cat = self.configuration.category_by_id(self.type)
     name = "%s.%s" % (self.ifwname, self.type)
     folder_package = "%s/%s" % (folder, name)
     if not os.path.isdir(folder_package):
         os.mkdir(folder_package)
     meta_folder = "%s/meta" % folder_package
     if os.path.isdir(meta_folder):
         shutil.rmtree(meta_folder)
     os.mkdir(meta_folder)
     if self.__is_default(self.type):
         is_default = 'true'
     else:
         is_default = 'false'
     p = IFWPackage(DisplayName=cat.Name,
                    Description=cat.Description,
                    Version=self.version,
                    ReleaseDate=self.date,
                    SortingPriority=cat.Priority,
                    Name=name,
                    Virtual='false',
                    Default=is_default,
                    TagDependencies=self.__clean_dependencies_doublons())
     p.save("%s/%s/meta/package.xml" % (folder, name))
Example #8
0
 def ifwpackage(self):
     return IFWPackage()