From 29e376fd1307b14c73a0cf0c1a093302558c71d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Briol?= Date: Tue, 17 Sep 2019 09:09:00 +0200 Subject: [PATCH] conda directory is missing in the code provided. --- conda/meta.yaml | 7 ++++--- setup.py | 31 +++++++++++++++++++------------ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/conda/meta.yaml b/conda/meta.yaml index 7ce85999..7fbcd36d 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -15,13 +15,14 @@ build: requirements: build: - - {{ compiler('cxx') }} # [linux] + - {{ compiler('cxx') }} # [linux or osx] + - vs2017_win-64 # [win] - cmake host: - eigen - gsl - - libboost - - numpy >=1.11 + - boost-cpp + - numpy - python - setuptools - xarray diff --git a/setup.py b/setup.py index ee78380e..f49be400 100755 --- a/setup.py +++ b/setup.py @@ -34,6 +34,21 @@ def execute(cmd): return process.stdout.read().decode() +def update_meta(path, version): + """Updating the version number description in conda/meta.yaml.""" + with open(path, "r") as stream: + lines = stream.readlines() + pattern = re.compile(r'{% set version = ".*" %}') + + for idx, line in enumerate(lines): + match = pattern.search(line) + if match is not None: + lines[idx] = '{%% set version = "%s" %%}\n' % version + + with open(path, "w") as stream: + stream.write("".join(lines)) + + def revision(): """Returns the software version""" cwd = pathlib.Path().absolute() @@ -67,19 +82,11 @@ def revision(): stdout = stdout.strip().split() date = datetime.datetime.utcfromtimestamp(int(stdout[1])) - # Updating the version number description in "meta.yaml" + # This file is not present in the distribution, but only in the GIT + # repository of the source code. meta = os.path.join(cwd, 'conda', 'meta.yaml') - with open(meta, "r") as stream: - lines = stream.readlines() - pattern = re.compile(r'{% set version = ".*" %}') - - for idx, line in enumerate(lines): - match = pattern.search(line) - if match is not None: - lines[idx] = '{%% set version = "%s" %%}\n' % version - - with open(meta, "w") as stream: - stream.write("".join(lines)) + if os.path.exists(meta): + update_meta(meta, version) # Updating the version number description for sphinx conf = os.path.join(cwd, 'docs', 'source', 'conf.py')