Skip to content

Commit c62c67e

Browse files
authored
Merge pull request #82 from gnikit/feature/conda-skip
Feature/conda skip
2 parents 7827dd5 + 9608c04 commit c62c67e

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## 2.2.7
44

5+
### Changed
6+
7+
- Changed the auto-update feature to skip `anaconda` environments since they
8+
handle their dependencies through `conda` and not `pip`
9+
510
### Fixed
611

712
- Fixed missing dependency from `setup.cfg`

fortls/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def commandline_args(name: str = "fortls") -> argparse.ArgumentParser:
2222
parser = argparse.ArgumentParser(
2323
description="fortls - Fortran Language Server",
2424
prog=name,
25-
usage="%(prog)s [options] [debug options]",
25+
usage="fortls [options] [debug options]",
2626
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=60),
2727
epilog=(
2828
"All options starting with '--' can also be set in a configuration file, by"

fortls/langserver.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ def serve_initialize(self, request):
214214
self._load_intrinsics()
215215
self._add_source_dirs()
216216
if self._update_version_pypi():
217-
log.log("Please restart the server for new version to activate")
217+
self.post_message(
218+
"Please restart the server for the new version to activate", 3
219+
)
218220

219221
# Initialize workspace
220222
self.workspace_init()
@@ -1665,10 +1667,13 @@ def _update_version_pypi(self, test: bool = False):
16651667
# This is the only reliable way to compare version semantics
16661668
if version.parse(info["info"]["version"]) > v or test:
16671669
self.post_message(
1668-
f"Using fortls {__version__}. A newer version of is"
1669-
" available through PyPi. An attempt will be made to update"
1670-
" the server",
1671-
3,
1670+
"A newer version of fortls is available for download", 3
1671+
)
1672+
# Anaconda environments should handle their updates through conda
1673+
if os.path.exists(os.path.join(sys.prefix, "conda-meta")):
1674+
return False
1675+
self.post_message(
1676+
f"Downloading from PyPi fortls {info['info']['version']}", 3
16721677
)
16731678
# Run pip
16741679
result = subprocess.run(

test/test_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def test_config_file_codeactions_options():
167167

168168

169169
def test_version_update_pypi():
170-
from fortls.langserver import LangServer
171170
from fortls.jsonrpc import JSONRPC2Connection, ReadWriter
171+
from fortls.langserver import LangServer
172172

173173
parser = commandline_args("fortls")
174174
args = parser.parse_args("-c f90_config.json".split())

0 commit comments

Comments
 (0)