From 281e0f5550d9e9fe7cc70223f3955197588f32ce Mon Sep 17 00:00:00 2001 From: Guido Imperiale Date: Sun, 2 Aug 2020 09:18:03 +0300 Subject: [PATCH] Support for PyCharm remote deployment w --- doc/whats-new.rst | 3 +++ setup.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 2ad2a426532..a786542053b 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 `_ .. _whats-new.0.16.0: 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")