AlexeySanko/pybuilder_semver_git_tag

Build fails if no remotes

Opened this issue · 4 comments

Thanks for your excellent plugin. When I start a new project I have local git repo and not yet created the remote repo but I can't do any build because this plugin fails the whole build if there are no remotes.

Attached stack trace, thanks again for excellent plugin.

$ pyb_ -t
Traceback (most recent call last):
  File "C:\Users\<username>\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\<username>\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\<username>\Development\<projectname>\venv\Scripts\pyb_.exe\__main__.py", line 9, in <module>
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\cli.py", line 377, in main
    exclude_all_optional=options.exclude_all_optional
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\reactor.py", line 108, in prepare_build
    self.project_module = self.load_project_module(project_descriptor)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\reactor.py", line 334, in load_project_module
    return imp.load_source("build", project_descriptor)
  File "C:\Users\<username>\AppData\Local\Programs\Python\Python37\lib\imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\<username>\Development\<projectname>\build.py", line 9, in <module>
    use_plugin('pypi:pybuilder_semver_git_tag')
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\core.py", line 218, in use_plugin
    reactor.require_plugin(name, version, plugin_module_name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\reactor.py", line 74, in require_plugin
    self.import_plugin(plugin, version, plugin_module_name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\reactor.py", line 199, in import_plugin
    plugin_module = self.plugin_loader.load_plugin(self.project, plugin, version, plugin_module_name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\pluginloader.py", line 150, in load_plugin
    return loader.load_plugin(project, name, version, plugin_module_name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\pluginloader.py", line 108, in load_plugin
    return self._load_installed_plugin(thirdparty_plugin, name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\pluginloader.py", line 129, in _load_installed_plugin
    plugin_module = _load_plugin(thirdparty_plugin, name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder\pluginloader.py", line 199, in _load_plugin
    __import__(plugin_module_name)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder_semver_git_tag\__init__.py", line 249, in <module>
    Reactor.current_instance().project, Reactor.current_instance().logger)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder_semver_git_tag\__init__.py", line 237, in force_semver_git_tag_plugin
    project.name = _get_repo_name(_get_repo_path(project))
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\pybuilder_semver_git_tag\__init__.py", line 116, in _get_repo_name
    return get_name_from_git_url(remotes[0].url)
  File "c:\users\<username>\development\<projectname>\venv\lib\site-packages\git\util.py", line 893, in __getitem__
    return list.__getitem__(self, index)
IndexError: list index out of range

Hi, @jlsheehan .
Thank You for feedback!
Unfortunately, more than year ago I changed job and switched to Bazel. I will be happy if You have possibility to contribute. But I don't know when I will have time for working with this plugin.

Some problems with PyBuilder on Python3 :(
https://travis-ci.org/AlexeySanko/pybuilder_semver_git_tag

It seems to be because coverage is 66% and version.py has no coverage, I'll see if I can fix it tonight...