예제 #1
0
    def return_main_screen(cls, status_code=0):
        try:
            truncated_version = get_version().split("+")[0]
            if status_code == 1 and not (get_latest_version() == truncated_version):
                print('''
Your currently installed version ({}) differs from the latest release ({})
Many issues are usually fixed in more up to date versions.
To get the latest version you can read the instructions at https://github.com/ubuntu/ubuntu-make
'''.format(get_version(), get_latest_version()))
        except Exception as e:
            logger.error(e)
        cls.currentUI._return_main_screen(status_code=status_code)
예제 #2
0
    def return_main_screen(cls, status_code=0):
        try:
            if status_code == 1 and not (get_latest_version()
                                         == get_version()):
                print('''
Your currently installed version ({}) differs from the latest release ({})
Many issues are usually fixed in more up to date versions.
To get the latest version you can read the instructions at https://github.com/ubuntu/ubuntu-make
'''.format(get_version(), get_latest_version()))
        except Exception as e:
            logger.error(e)
        cls.currentUI._return_main_screen(status_code=status_code)
예제 #3
0
def main(parser):
    """Main entry point of the cli command"""
    categories_parser = parser.add_subparsers(help='Developer environment',
                                              dest="category")
    for category in BaseCategory.categories.values():
        category.install_category_parser(categories_parser)

    argcomplete.autocomplete(parser)
    # autocomplete will stop there. Can start more expensive operations now.

    arg_to_parse = sys.argv[1:]
    if "--help" not in arg_to_parse:
        # manipulate sys.argv for default frameworks:
        arg_to_parse = mangle_args_for_default_framework(arg_to_parse)
    args = parser.parse_args(arg_to_parse)

    if args.list or args.list_installed or args.list_available:
        print(get_frameworks_list_output(args))
        sys.exit(0)

    if args.version:
        print(get_version())
        sys.exit(0)

    if not args.category:
        parser.print_help()
        sys.exit(0)

    CliUI()
    run_command_for_args(args)
예제 #4
0
 def test_version_snap(self, path_join_result):
     """Ensure we are returning the right version for a snap"""
     path_join_result.side_effect = self.return_fake_version_path
     os.environ.clear()
     os.environ.update(self.initial_env)
     os.environ["SNAP_REVISION"] = "42"
     self.assertEquals(settings.get_version(), "42.02+snap42")
예제 #5
0
def main(parser):
    """Main entry point of the cli command"""
    categories_parser = parser.add_subparsers(help='Developer environment', dest="category")
    for category in BaseCategory.categories.values():
        category.install_category_parser(categories_parser)

    argcomplete.autocomplete(parser)
    # autocomplete will stop there. Can start more expensive operations now.

    arg_to_parse = sys.argv[1:]
    if "--help" not in arg_to_parse:
        # manipulate sys.argv for default frameworks:
        arg_to_parse = mangle_args_for_default_framework(arg_to_parse)
    args = parser.parse_args(arg_to_parse)

    if args.list or args.list_installed or args.list_available:
        print(get_frameworks_list_output(args))
        sys.exit(0)

    if args.version:
        print(get_version())
        sys.exit(0)

    if not args.category:
        parser.print_help()
        sys.exit(0)

    CliUI()
    run_command_for_args(args)
예제 #6
0
 def test_version_git_fail(self, path_join_result):
     """Ensure we are returning last known version + unknown if git fails"""
     settings.from_dev = True
     path_join_result.side_effect = self.return_fake_version_path
     os.environ["PATH"] = "{}:{}".format(
         os.path.join(get_data_dir(), "mocks", "fails"), os.getenv("PATH"))
     self.assertEquals(settings.get_version(), "42.02+unknown")
예제 #7
0
 def test_version_snap(self, path_join_result):
     """Ensure we are returning the right version for a snap"""
     path_join_result.side_effect = self.return_fake_version_path
     os.environ.clear()
     os.environ.update(self.initial_env)
     os.environ["SNAP_REVISION"] = "42"
     self.assertEquals(settings.get_version(), "42.02+snap42")
예제 #8
0
파일: setup.py 프로젝트: ubuntu/ubuntu-make
    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        source_pot = os.path.join(os.curdir, 'po', '{}.pot'.format(I18N_DOMAIN))
        for po_file in glob(os.path.join(os.curdir, 'po', '*.po')):
            subprocess.check_call(["msgmerge", "-U", po_file, source_pot])


setup(
    name="Ubuntu Make",
    version=get_version(),
    packages=find_packages(exclude=["tests*"]),
    package_data={},
    entry_points={
        'console_scripts': [
            'umake = umake:main',
            'udtc = umake:main'
        ],
    },

    data_files=[
        ('lib/python3/dist-packages/umake', ['umake/version']),
        ("share/ubuntu-make/log-confs", glob('log-confs/*.yaml')),
        ('share/zsh/vendor-completions', ['confs/completions/_umake']),
    ],
예제 #9
0
 def test_version_git_not_installed(self, path_join_result):
     """Ensure we are returning last known version + unknown if git isn't installed"""
     settings.from_dev = True
     path_join_result.side_effect = self.return_fake_version_path
     os.environ["PATH"] = ""
     self.assertEquals(settings.get_version(), "42.02+unknown")
예제 #10
0
 def test_version_git_fail(self, path_join_result):
     """Ensure we are returning last known version + unknown if git fails"""
     settings.from_dev = True
     path_join_result.side_effect = self.return_fake_version_path
     os.environ["PATH"] = "{}:{}".format(os.path.join(get_data_dir(), "mocks", "fails"), os.getenv("PATH"))
     self.assertEquals(settings.get_version(), "42.02+unknown")
예제 #11
0
 def test_version_git(self, path_join_result):
     """Ensure we are returning the right version for a git repo"""
     settings.from_dev = True
     path_join_result.side_effect = self.return_fake_version_path
     self.assertEquals(settings.get_version(), "42.03-25-g1fd9507")
예제 #12
0
 def test_version_release(self, path_join_result):
     """Ensure we are returning the right version for a release"""
     path_join_result.side_effect = self.return_fake_version_path
     os.environ = self.initial_env
     self.assertEquals(settings.get_version(), "42.02")
예제 #13
0
 def test_version_git_not_installed(self, path_join_result):
     """Ensure we are returning last known version + unknown if git isn't installed"""
     settings.from_dev = True
     path_join_result.side_effect = self.return_fake_version_path
     os.environ["PATH"] = ""
     self.assertEquals(settings.get_version(), "42.02+unknown")
예제 #14
0
 def test_version_git(self, path_join_result):
     """Ensure we are returning the right version for a git repo"""
     settings.from_dev = True
     path_join_result.side_effect = self.return_fake_version_path
     self.assertEquals(settings.get_version(), "42.03-25-g1fd9507")
예제 #15
0
 def test_version_release(self, path_join_result):
     """Ensure we are returning the right version for a release"""
     path_join_result.side_effect = self.return_fake_version_path
     os.environ.clear()
     os.environ.update(self.initial_env)
     self.assertEquals(settings.get_version(), "42.02")
예제 #16
0
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        source_pot = os.path.join(os.curdir, 'po', '{}.pot'.format(I18N_DOMAIN))
        for po_file in glob(os.path.join(os.curdir, 'po', '*.po')):
            subprocess.check_call(["msgmerge", "-U", po_file, source_pot])

setup(
    name="Ubuntu Make",
    version=get_version(),
    packages=find_packages(exclude=["tests*"]),
    package_data={},
    entry_points={
        'console_scripts': [
            'umake = umake:main',
            'udtc = umake:main'
        ],
    },

    data_files=[
        ('lib/python3/dist-packages/umake', ['umake/version']),
        ("share/ubuntu-make/log-confs", glob('log-confs/*.yaml')),
        ('share/zsh/vendor-completions', ['confs/completions/_umake']),
    ],