Skip to content

Commit

Permalink
Merge pull request #82 from gnikit/feature/conda-skip
Browse files Browse the repository at this point in the history
Feature/conda skip
  • Loading branch information
gnikit authored Mar 10, 2022
2 parents 7827dd5 + 9608c04 commit c62c67e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## 2.2.7

### Changed

- Changed the auto-update feature to skip `anaconda` environments since they
handle their dependencies through `conda` and not `pip`

### Fixed

- Fixed missing dependency from `setup.cfg`
Expand Down
2 changes: 1 addition & 1 deletion fortls/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def commandline_args(name: str = "fortls") -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description="fortls - Fortran Language Server",
prog=name,
usage="%(prog)s [options] [debug options]",
usage="fortls [options] [debug options]",
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=60),
epilog=(
"All options starting with '--' can also be set in a configuration file, by"
Expand Down
15 changes: 10 additions & 5 deletions fortls/langserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ def serve_initialize(self, request):
self._load_intrinsics()
self._add_source_dirs()
if self._update_version_pypi():
log.log("Please restart the server for new version to activate")
self.post_message(
"Please restart the server for the new version to activate", 3
)

# Initialize workspace
self.workspace_init()
Expand Down Expand Up @@ -1665,10 +1667,13 @@ def _update_version_pypi(self, test: bool = False):
# This is the only reliable way to compare version semantics
if version.parse(info["info"]["version"]) > v or test:
self.post_message(
f"Using fortls {__version__}. A newer version of is"
" available through PyPi. An attempt will be made to update"
" the server",
3,
"A newer version of fortls is available for download", 3
)
# Anaconda environments should handle their updates through conda
if os.path.exists(os.path.join(sys.prefix, "conda-meta")):
return False
self.post_message(
f"Downloading from PyPi fortls {info['info']['version']}", 3
)
# Run pip
result = subprocess.run(
Expand Down
2 changes: 1 addition & 1 deletion test/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def test_config_file_codeactions_options():


def test_version_update_pypi():
from fortls.langserver import LangServer
from fortls.jsonrpc import JSONRPC2Connection, ReadWriter
from fortls.langserver import LangServer

parser = commandline_args("fortls")
args = parser.parse_args("-c f90_config.json".split())
Expand Down

0 comments on commit c62c67e

Please sign in to comment.