diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 4b8f980cade..81ef2cd9e17 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -45,6 +45,9 @@ Documentation Internal Changes ~~~~~~~~~~~~~~~~ +- Fix ``pip install .`` when no ``.git`` directory exists; namely when the xarray source + directory has been rsync'ed by PyCharm Professional for a remote deployment over SSH. + By `Guido Imperiale `_ - Only load resource files when running inside a Jupyter Notebook (:issue:`4294`) By `Guido Imperiale `_ diff --git a/setup.py b/setup.py index 76755a445f7..e7cd9bc18e2 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,11 @@ #!/usr/bin/env python from setuptools import setup -setup(use_scm_version=True) +try: + setup(use_scm_version=True) +except LookupError as e: + # .git has been removed, and this is not a package created by sdist + # This is the case e.g. of a remote deployment with PyCharm Professional + if not str(e).startswith("setuptools-scm was unable to detect version"): + raise + setup(version="999")