Пример #1
0
def test_bvi_xml_Configuration_Repostiroy():
    x = Configuration(EXAMPLE)
    assert len(x.Repositories) == 4
    assert x.Repositories[0].Url == 'http://localhost/repositories/win32/'
    assert x.Repositories[1].Url == 'http://localhost/repositories/osx/'
    assert x.Repositories[2].Url == 'http://localhost/repositories/linux32/'
    assert x.Repositories[3].Url == 'http://localhost/repositories/linux64/'
Пример #2
0
def test_bvi_xml_Configuration_Licenses():
    x = Configuration(EXAMPLE)
    assert x.Licenses[0].Id == 'CECILL_2.1'
    assert x.Licenses[0].Version == '2.1'
    assert x.Licenses[0].Name == 'CeCILL v2.1'
    assert x.Licenses[0].File == 'License_CeCILL_V2.1_en_EN.txt'
    assert x.Licenses[3].Name == 'GPL 3.0'
Пример #3
0
def test_is_package_excluded():
    x = Configuration(EXAMPLE)
    assert x.is_package_excluded('libqt4-multimedia') == True
    assert x.is_package_excluded('corist') == False
    assert x.is_package_excluded('brainvisa-share') == False
    assert x.is_package_excluded('anatomist-free') == False
    assert x.is_package_excluded('liblapack3gf-0') == False
Пример #4
0
def test_bvi_xml_Configuration_Categories():
    x = Configuration(EXAMPLE)
    assert x.Categories[0].Name == 'BrainVISA Suite'
    assert x.Categories[
        0].Description == 'Description of BrainVISA Suite category'
    assert x.Categories[1].Subcategories[0].Name == 'Sources'
    assert x.Categories[1].Subcategories[1].Id == 'devdoc'
def test_Repository__create_packages_licenses():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    folder = "%s/out/repository_pack_lic" % FULLPATH
    os.mkdir(folder)
    os.mkdir("%s/packages" % folder)
    y = Repository(folder, x, None)
    y._Repository__create_packages_licenses()
    filename = '%s/packages/brainvisa.app.licenses/meta/package.xml' % folder
    assert os.path.isdir('%s/packages/brainvisa.app.licenses' % folder)
    assert os.path.isdir('%s/packages/brainvisa.app.licenses/meta' % folder)
    assert os.path.isfile(filename)
    assert '<DisplayName>Licenses</DisplayName>' in open(filename, 'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()
    assert '<Name>brainvisa.app.licenses</Name>' in open(filename, 'r').read()
    assert '<Virtual>true</Virtual>' in open(filename, 'r').read()

    assert os.path.isdir('%s/packages/brainvisa.app.licenses.cecill_b' %
                         folder)
    assert os.path.isdir('%s/packages/brainvisa.app.licenses.cecill_b/meta' %
                         folder)
    filename_lic = '%s/packages/brainvisa.app.licenses.cecill_b/meta/package.xml' % folder
    assert os.path.isfile(filename_lic)
    assert os.path.isfile(
        '%s/packages/brainvisa.app.licenses.cecill_b/meta/License_CeCILL-B_V1_en_EN.txt'
        % folder)
    assert '<License' in open(filename_lic, 'r').read()
    assert 'name="CeCILL-B"' in open(filename_lic, 'r').read()
    assert 'file="License_CeCILL-B_V1_en_EN.txt"' in open(filename_lic,
                                                          'r').read()
def test_Repository__create_package_bv_env():
    x = Configuration("%s/in/configuration_script.xml" % FULLPATH)
    folder = "%s/out/repository_pack_bv_env" % FULLPATH
    os.mkdir(folder)
    os.mkdir("%s/packages" % folder)
    y = Repository(folder, x, None)
    y._Repository__create_package_bv_env()
    filename = '%s/packages/brainvisa.app.thirdparty.bv_env/meta/package.xml' % folder
    assert os.path.isdir('%s/packages/brainvisa.app.thirdparty.bv_env/meta' %
                         folder)
    assert os.path.isdir('%s/packages/brainvisa.app.thirdparty.bv_env/data' %
                         folder)
    assert os.path.isfile(filename)
    assert '<Version>1.0</Version>' in open(filename, 'r').read()
    assert '<Name>brainvisa.app.thirdparty.bv_env</Name>' in open(
        filename, 'r').read()
    assert '<Virtual>true</Virtual>' in open(filename, 'r').read()
    assert os.path.isfile(
        '%s/packages/brainvisa.app.thirdparty.bv_env/data/bin/bv_env.sh' %
        folder)
    assert os.path.isfile(
        '%s/packages/brainvisa.app.thirdparty.bv_env/data/bin/bv_unenv' %
        folder)
    assert os.path.isfile(
        '%s/packages/brainvisa.app.thirdparty.bv_env/data/bin/bv_unenv.sh' %
        folder)

    assert os.path.isfile(
        '%s/packages/brainvisa.app.thirdparty.bv_env/meta/script.qs' % folder)
Пример #7
0
def test_ConcreteComponent__package_data_2():
    y = Configuration("%s/in/configuration.xml" % FULLPATH)
    x = ConcreteComponent('corist', True, y)
    folder = '%s/out/corist' % FULLPATH
    os.mkdir(folder)
    x._Component__package_data(folder)
    assert os.path.isdir("%s/data" % folder) == False
Пример #8
0
def test_Project__create_subcategorie():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    y = Project('anatomist', x)
    for y.type in y.types:
        y._Project__create_subcategorie("%s/out" % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.run' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.run/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.usrdoc' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.usrdoc/meta' %
                         FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.dev' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.dev/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.devdoc' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.devdoc/meta' %
                         FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.anatomist.run/meta/package.xml' % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.anatomist.usrdoc/meta/package.xml' % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.dev.anatomist.dev/meta/package.xml' % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.dev.anatomist.devdoc/meta/package.xml' % FULLPATH)

    filename = '%s/out/brainvisa.app.anatomist.run/meta/package.xml' % FULLPATH
    assert '<DisplayName>%s</DisplayName>' % x.category_by_id(
        'run').Name in open(filename, 'r').read()
    assert '<Name>brainvisa.app.anatomist.run</Name>' in open(filename,
                                                              'r').read()
    assert '<Version>4.5.0</Version>' in open(filename, 'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()
def test_Repository_init():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    folder = "%s/out/repository" % FULLPATH
    y = Repository(folder, x, None)
    assert y.folder == folder
    assert y.configuration == x
    assert y.date == CURRENTDATE
    assert y.components == None
Пример #10
0
def test_ConcreteComponent__package_meta():
    y = Configuration()
    x = ConcreteComponent('anatomist-gpl', True, y)
    folder = '%s/out/anatomist_gpl' % FULLPATH
    os.mkdir(folder)
    x._Component__package_meta(folder)
    assert os.path.isdir("%s/meta" % folder)
    assert os.path.isfile("%s/meta/package.xml" % folder)
Пример #11
0
def test_ConcreteComponent__package_meta_2():
    y = Configuration()
    x = ConcreteComponent('liblapack3gf-0', True, y)
    folder = '%s/out/liblapack3gf_0' % FULLPATH
    os.mkdir(folder)
    x._Component__package_meta(folder)
    assert os.path.isdir("%s/meta" % folder)
    assert os.path.isfile("%s/meta/package.xml" % folder)
    assert x.version == "3.0"
Пример #12
0
def test_bvi_xml_Configuration_Alt_Licenses():
    x = Configuration(EXAMPLE, EXAMPLE_PARTIAL)
    assert x.Licenses[0].Id == 'CECILL_2.1'
    assert x.Licenses[0].Version == '2.1'
    assert x.Licenses[0].Name == 'CeCILL v2.1'
    assert x.Licenses[3].Name == 'GPL 3.0'
    assert len(x.Licenses) == 7
    assert x.Licenses[5].Id == 'License 02.3X.1'
    assert x.Licenses[6].Name == 'License 0x9'
Пример #13
0
def test_create():
    y = Configuration("%s/in/configuration.xml" % FULLPATH)
    x = ConcreteComponent('soma-io', True, y)
    x.create("%s/out" % FULLPATH)
    assert os.path.isdir("%s/out/ifwname" % FULLPATH)
    assert os.path.isdir("%s/out/ifwname/meta" % FULLPATH)
    assert os.path.isdir("%s/out/ifwname/data" % FULLPATH)
    assert os.path.isdir("%s/out/ifwname/data/bin" % FULLPATH)
    assert os.path.isdir("%s/out/ifwname/data/share" % FULLPATH)
    assert os.path.isfile("%s/out/ifwname/meta/package.xml" % FULLPATH)
Пример #14
0
def test_iProject_fwpackage():
    x = Configuration()
    y = Project('anatomist', x)
    y.type = 'run'
    p = y.ifwpackage
    assert p.DisplayName == 'Anatomist'
    assert p.Description == project_description('anatomist')
    assert p.Version == '4.5.0'
    assert p.ReleaseDate == CURRENTDATE
    assert p.Name == 'brainvisa.app.anatomist'
    assert p.Virtual == 'false'
Пример #15
0
def test_Project_ifwname():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    y = Project('anatomist', x)
    y.type = 'run'
    assert y.ifwname == 'brainvisa.app.anatomist'
    y.type = 'usrdoc'
    assert y.ifwname == 'brainvisa.app.anatomist'
    y.type = 'dev'
    assert y.ifwname == 'brainvisa.dev.anatomist'
    y.type = 'devdoc'
    assert y.ifwname == 'brainvisa.dev.anatomist'
def test_Repository_create():
    x = Configuration()
    y = [
        Project('soma', x),
        Project('aims', x),
        Project('anatomist', x),
        Project('axon', x)
    ]
    z = Repository(folder="%s/out/Repository_Final" % FULLPATH,
                   configuration=x,
                   components=y)
    z.create()
Пример #17
0
def test_Project_init():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    y = Project('anatomist', x)
    assert y.name == 'anatomist'
    assert y.project == 'anatomist'
    assert y.types == ['run', 'usrdoc', 'dev', 'devdoc']
    assert y.type == None
    assert y.configuration == x
    assert y.licenses == None
    assert y.data == None
    assert y.dep_packages == collections.defaultdict(list)
    assert y.version == '4.5.0'
Пример #18
0
def test_bvi_xml_Configuration():
    x = Configuration(EXAMPLE)
    assert x.Name == 'BrainVISA Installer'
    assert x.Version == '1.0.0'
    assert x.Title == 'BrainVISA Installer'
    assert x.Publisher == 'CEA IFR49 / I2BM'
    assert x.Producturl == 'http://brainvisa.info/'
    assert x.Targetdir == '@homeDir@/brainvisa'
    assert x.Admintargetdir == '@rootDir@/brainvisa'
    assert x.MaintenanceToolName == 'BrainVISA_Suite-Update'
    assert x.Allownonasciicharacters == 'true'
    assert x.Allowspaceinpath == 'true'
Пример #19
0
def test_ConcreteComponent__package_data():
    y = Configuration()
    x = ConcreteComponent('axon', True, y)
    folder = '%s/out/axon' % FULLPATH
    os.mkdir(folder)
    x._Component__package_data(folder)
    assert os.path.isdir("%s/data" % folder)
    assert os.path.isdir("%s/data/bin" % folder)
    assert os.path.isdir("%s/data/brainvisa" % folder)
    assert os.path.isdir("%s/data/python" % folder)
    assert os.path.isdir("%s/data/scripts" % folder)
    assert os.path.isdir("%s/data/share" % folder)
    assert os.path.isfile("%s/data/BrainVISA" % folder)
    assert os.path.isfile("%s/data/bin/brainvisa" % folder)
Пример #20
0
def test_bvi_xml_Configuration_Alt_Repositories():
    x = Configuration(EXAMPLE, EXAMPLE_PARTIAL)
    assert len(x.Repositories) == 6
    assert x.Repositories[
        4].Url == 'http://localhost/repositories2x08734/win32/'
    assert x.Repositories[4].Enabled == '0'
    assert x.Repositories[
        5].Url == 'http://localhost/repositories2x08734/linux64/'
    assert x.Repositories[5].Enabled == '1'
    assert x.Repositories[0].Url == 'http://localhost/repositories/win32/'
    assert x.Repositories[0].Enabled == '0'
    assert x.Repositories[2].Url == 'http://localhost/repositories/linux32/'
    assert x.Repositories[3].Url == 'http://localhost/repositories/linux64/'
    assert x.Repositories[3].Enabled == '1'  # OS dependent
Пример #21
0
def test_create_3():
    z = Configuration("%s/in/configuration.xml" % FULLPATH)
    x = Package(name='libncurses5', configuration=z)
    x.create("%s/out" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.thirdparty.libncurses5" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.thirdparty.libncurses5/meta" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.thirdparty.libncurses5/data" % FULLPATH)
    assert os.path.isfile(
        "%s/out/brainvisa.app.thirdparty.libncurses5/meta/package.xml" % FULLPATH)
    assert x.version == '0.0.0'
    assert "<Version>0.0.0</Version>" in open(
        "%s/out/brainvisa.app.thirdparty.libncurses5/meta/package.xml" % FULLPATH, 'r').read()
Пример #22
0
def test_create_1():
    z = Configuration("%s/in/configuration.xml" % FULLPATH)
    x = Package(name='libsqlite3-0', configuration=z)
    x.create("%s/out" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.thirdparty.libsqlite3_0" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.thirdparty.libsqlite3_0/meta" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.thirdparty.libsqlite3_0/data" % FULLPATH)
    assert os.path.isfile(
        "%s/out/brainvisa.app.thirdparty.libsqlite3_0/meta/package.xml" % FULLPATH)
    assert x.version == '3.7.17'
    assert "<Version>3.7.17</Version>" in open(
        "%s/out/brainvisa.app.thirdparty.libsqlite3_0/meta/package.xml" % FULLPATH, 'r').read()
Пример #23
0
def test_create_script():
    y = Configuration("%s/in/configuration_script.xml" % FULLPATH)
    x = Package('anatomist-free', y)
    x.create("%s/out" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.anatomist.run.anatomist_free" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.anatomist.run.anatomist_free/meta" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.anatomist.run.anatomist_free/data" % FULLPATH)
    assert os.path.isdir(
        "%s/out/brainvisa.app.anatomist.run.anatomist_free/data/bin" % FULLPATH)
    assert os.path.isfile(
        "%s/out/brainvisa.app.anatomist.run.anatomist_free/meta/package.xml" % FULLPATH)
    assert os.path.isfile(
        "%s/out/brainvisa.app.anatomist.run.anatomist_free/meta/script.qs" % FULLPATH)
def test_Repository__create_packages_dev():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    folder = "%s/out/repository_pack_dev" % FULLPATH
    os.mkdir(folder)
    os.mkdir("%s/packages" % folder)
    y = Repository(folder, x, None)
    y._Repository__create_packages_dev()
    filename = '%s/packages/brainvisa.dev/meta/package.xml' % folder
    assert os.path.isdir('%s/packages/brainvisa.dev' % folder)
    assert os.path.isdir('%s/packages/brainvisa.dev/meta' % folder)
    assert os.path.isfile(filename)
    assert '<DisplayName>%s</DisplayName>' % x.category_by_id(
        'DEV').Name in open(filename, 'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()
    assert '<Name>brainvisa.dev</Name>' in open(filename, 'r').read()
def test_Repository__create_packages_thirdparty():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    folder = "%s/out/repository_pack_tp" % FULLPATH
    os.mkdir(folder)
    os.mkdir("%s/packages" % folder)
    y = Repository(folder, x, None)
    y._Repository__create_packages_thirdparty()
    filename = '%s/packages/brainvisa.app.thirdparty/meta/package.xml' % folder
    assert os.path.isdir('%s/packages/brainvisa.app.thirdparty' % folder)
    assert os.path.isdir('%s/packages/brainvisa.app.thirdparty/meta' % folder)
    assert os.path.isfile(filename)
    assert '<DisplayName>Thirdparty</DisplayName>' in open(filename,
                                                           'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()
    assert '<Name>brainvisa.app.thirdparty</Name>' in open(filename,
                                                           'r').read()
    assert '<Virtual>true</Virtual>' in open(filename, 'r').read()
def test_Repository__create_config():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    folder = "%s/out/repository" % FULLPATH
    os.mkdir(folder)
    y = Repository(folder, x, None)
    y._Repository__create_config()
    assert os.path.isdir("%s/config" % folder)
    assert os.path.isfile("%s/config/config.xml" % folder)
    z = XmlFile()
    z.read("%s/config/config.xml" % folder)
    assert z.root.find('Name').text == 'BrainVISA Installer'
    assert z.root.find('Version').text == '1.0.0'
    assert z.root.find('Title').text == 'BrainVISA Installer'
    assert z.root.find('Publisher').text == 'CEA IFR49 / I2BM'
    assert z.root.find('ProductUrl').text == 'http://brainvisa.info/'
    rr = z.root.find('RemoteRepositories')
    assert rr[0].find('Url').text == 'http://localhost/repositories/win32/'
    assert rr[3].find('Url').text == 'http://localhost/repositories/linux64/'
Пример #27
0
def test_Project_create():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    y = Project('axon', x)
    y.create('%s/out' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.axon.run' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.axon.run/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.axon.usrdoc' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.axon.usrdoc/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.axon.dev' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.axon.dev/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.axon.devdoc' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.axon.devdoc/meta' % FULLPATH)

    assert os.path.isdir('%s/out/brainvisa.app.axon' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.axon/meta' % FULLPATH)
    assert os.path.isfile('%s/out/brainvisa.app.axon/meta/package.xml' %
                          FULLPATH)

    filename = '%s/out/brainvisa.app.axon/meta/package.xml' % FULLPATH
    assert '<DisplayName>Axon</DisplayName>' in open(filename, 'r').read()
    assert '<Name>brainvisa.app.axon</Name>' in open(filename, 'r').read()
    assert '<Version>4.5.0</Version>' in open(filename, 'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()

    assert os.path.isdir('%s/out/brainvisa.app.thirdparty.graphviz' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.axon.devdoc.axon_devdoc' %
                         FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.soma.run.soma_qtgui' % FULLPATH)

    assert os.path.isfile(
        '%s/out/brainvisa.app.aims.run.aims_free/data/bin/AimsAttributedViewer'
        % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.aims.run.aims_free/data/bin/AimsClosing' %
        FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.aims.run.aims_free/data/bin/AimsElevationMap' %
        FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.aims.run.aims_free/data/bin/AimsImageScaleSpace'
        % FULLPATH)
    def __init__(self, argv):
        "Parse the command line arguments."
        parser = argparse.ArgumentParser(
            formatter_class=argparse.RawDescriptionHelpFormatter,
            description=MESSAGE_HELP_HEADER,
            epilog=MESSAGE_HELP_EPILOG)

        parser.add_argument('-p',
                            '--projects',
                            type=valid_projects,
                            nargs='+',
                            metavar='project',
                            help='Projects to include in the installer and '
                            'the repository')

        parser.add_argument('-n',
                            '--names',
                            type=valid_names,
                            nargs='+',
                            metavar='name',
                            help='Package names to include in the installer '
                            'and the repository')

        parser.add_argument('-t',
                            '--types',
                            nargs='+',
                            choices=['run', 'dev', 'usrdoc', 'devdoc', 'test'],
                            default=['run', 'dev', 'usrdoc', 'devdoc', 'test'],
                            metavar='types',
                            help='Package\'s types (default: "run", "dev", '
                            '"usrdoc", "devdoc" and "test")')

        parser.add_argument('--online-only',
                            action='store_true',
                            help='Create only an online installer')

        parser.add_argument('--offline-only',
                            action='store_true',
                            help='Create only an offline installer')

        parser.add_argument('--repository-only',
                            action='store_true',
                            help='Create only the repository for the online '
                            'installer')

        parser.add_argument('--compress',
                            action='store_true',
                            help='The packages data in the temporary '
                            'repository will be compressed [experimental].')

        parser.add_argument(
            '-i',
            '--installer',
            default=None,
            metavar='file',
            help=
            'Installer name (optional only if --repository-only is specified). Note: if an additional offline installer (-j option) is specified, -i will be an online-only installer. Otherwise it will follow the options --online-only and --offline-only if they are specified, with the same meaning as in the binarycreator tool.'
        )

        parser.add_argument(
            '-j',
            '--offline-installer',
            default=None,
            metavar='file',
            help=
            'Offline installer name (optional). The offline installer will contain all packages, ignoring --online-only option, but still following --offline-only if specified. Using both -i and -j will generate two installer binaries, one online and one offline.'
        )

        parser.add_argument('-r',
                            '--repository',
                            default=None,
                            metavar='dir',
                            required=True,
                            help='Repository name.')

        parser.add_argument(
            '-f',
            '--additional-repositories',
            default=[],
            nargs='+',
            metavar='additional_dir',
            help=
            'Additional existing repositories (optional). This is particularly usefull for offline installer that need to contain all installation packages. This packages may exists in separated repositories.'
        )

        parser.add_argument('-c',
                            '--config',
                            type=valid_config,
                            default=None,
                            metavar='file',
                            help='Additional configuration XML file')

        parser.add_argument('--no-main-config',
                            action='store_true',
                            help='don\'t read the main BrainVisa config file. '
                            'Must be used with the -c option')

        parser.add_argument(
            '--qt_menu_nib',
            default=None,
            help=
            'For Mac OS X 10.5: copy the specified qt_menu.nib folder in the \
            installer OSX App package. Use this option if the OS X installer \
            did not find the qt_menu.nib folder.')

        parser.add_argument('--release',
                            type=valid_release,
                            default=None,
                            help='force repository release version. default: '
                            'use BrainVISA release version from the current '
                            'build.')

        parser.add_argument(
            '--i2bm',
            action='store_true',
            help=
            'Include I2BM private components - by default such private components are excluded from the package.'
        )

        parser.add_argument('--data',
                            action='store_true',
                            help='Package only data packages (which are '
                            'excluded from normal packaging).')

        parser.add_argument('-v',
                            '--version',
                            action='version',
                            version='%(prog)s [' + __status__ + '] - ' +
                            __version__,
                            help='Show the version number.')

        parser.add_argument('--no-thirdparty',
                            action='store_true',
                            help='Do not package thirdparty libraries, and '
                            'ignore them in dependencies.')

        parser.add_argument(
            '--no-dependencies',
            action='store_true',
            help=
            'Do not package dependencies: take only explicitely named packages/projects. Their dependencies will still be marked so they must either already exist in the repository, either exist in another repository.'
        )

        parser.add_argument('--platform-target',
                            dest='platform_target',
                            default=None,
                            help='target platform to use for cross '
                            'compilation (default: %s)' %
                            System.platform().lower())

        parser.add_argument('--platform_name',
                            default=None,
                            help='force platform name in packages repository '
                            'URL (default: %s)' % System.platform().lower())

        parser.add_argument('--make-options',
                            dest='make_options',
                            default=None,
                            help='make options to use during components '
                            'packaging')

        parser.add_argument('--binary-creator-cmd',
                            dest='binary_creator_command',
                            default=None,
                            help='Path to the binary creator command to use '
                            'to generate the installer.')

        parser.add_argument('--archivegen-cmd',
                            dest='archivegen_cmd',
                            default=None,
                            help='Path to the archivegen command to use to '
                            'generate 7z archives. Default: look (in that '
                            'order) for: 7z, 7za, archivegen.')

        parser.add_argument('--archivegen-opts',
                            dest='archivegen_opts',
                            default='',
                            help='archivegen command options. Default: none '
                            'for archivegen, "a" for 7z/7za. Options are '
                            'split by space character.')

        parser.add_argument('--skip-repos',
                            dest='skip_repos',
                            action='store_true',
                            help='Skip initial (temp) repository creation. '
                            'Assumes it has already been done.')

        parser.add_argument('--skip-repogen',
                            dest='skip_repogen',
                            action='store_true',
                            help='Skip repogen (final repository creation + '
                            'compression). Assumes it has already been done.')

        parser.add_argument('--skip-existing',
                            dest='skip_existing',
                            action='store_true',
                            help='Don\'t rebuild components which already '
                            'have a directory in the temporary repository '
                            'directory.')

        self.__configure_logging()
        args = parser.parse_args(argv[1:])

        if args.online_only + args.offline_only + args.repository_only > 1:
            logging.getLogger().error(
                "[ BVI ] Error: --online-only, --offline-only and "
                "--repository-only are incompatible.")
            exit(1)

        if args.qt_menu_nib is not None:
            if args.installer is None and args.offline_installer is None:
                logging.getLogger().error(
                    "[ BVI ] Error: --installer and/or --offline_installer "
                    "must be specified if --qt_menu_nib is used.")
                exit(1)
            if System.platform() != System.MacOSX:
                logging.getLogger().error(
                    "[ BVI ] Error: --qt_menu_nib is only for Mac OS X.")
                exit(1)

        self.args = args
        self.logging_level = logging.DEBUG
        if self.args.no_main_config:
            kwargs = {'filename': self.args.config}
        else:
            kwargs = {'alt_filename': self.args.config}
        if self.args.release is not None:
            kwargs['release'] = self.args.release
        if self.args.no_thirdparty:
            kwargs['with_thirdparty'] = False
        if self.args.no_dependencies:
            kwargs['with_dependencies'] = False
        if self.args.platform_target:
            kwargs['platform_target'] = self.args.platform_target
            if not self.args.platform_name:
                # Defaultly use target platform as platform name
                self.args.platform_name = self.args.platform_target
        if self.args.platform_name:
            kwargs['platform_name'] = self.args.platform_name

        kwargs['make_options'] = self.args.make_options
        kwargs['binary_creator_command'] = self.args.binary_creator_command
        kwargs['archivegen_cmd'] = self.args.archivegen_cmd
        kwargs['archivegen_opts'] = self.args.archivegen_opts.split(' ')
        if kwargs['archivegen_opts'] == ['']:
            kwargs['archivegen_opts'] = []
        kwargs['skip_repos'] = self.args.skip_repos
        kwargs['skip_repogen'] = self.args.skip_repogen
        kwargs['skip_existing'] = self.args.skip_existing
        kwargs['data_packages'] = self.args.data
        kwargs['private_repos'] = self.args.i2bm
        self.config = Configuration(**kwargs)
        self.components = self.__group_components()
Пример #29
0
def test_is_packaging_excluded_osx():
    x = Configuration(EXAMPLE)
    assert x.is_packaging_excluded('anatomist-free') == False
    assert x.is_packaging_excluded('brainvisa-share') == False
    assert x.is_packaging_excluded('libboost') == False
Пример #30
0
def test_bvi_xml_Configuration_Repostiroy_enabled_osx():
    x = Configuration(EXAMPLE)
    assert x.Repositories[0].Enabled == '0'  # win32
    assert x.Repositories[1].Enabled == '1'  # osx
    assert x.Repositories[2].Enabled == '0'  # linux32
    assert x.Repositories[3].Enabled == '0'  # linux64