Skip to content

Commit

Permalink
conda directory is missing in the code provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
fbriol committed Sep 17, 2019
1 parent 9218b39 commit 29e376f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
7 changes: 4 additions & 3 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 19 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 29e376f

Please sign in to comment.