Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure url and summary of a taggedenv and env. #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions conda_rpms/build_rpm_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ def __getitem__(self, key):
except KeyError:
emsg = 'The YAML file {!r} does not contain key [{}].'
full_key = ']['.join(self._key + [key])
raise ValueError(emsg.format(os.path.basename(self.fname),
full_key))
raise KeyError(emsg.format(os.path.basename(self.fname),
full_key))
if isinstance(result, dict):
result = Config(self.fname, result, self._key + [key])
return result

def get(self, key, default=None):
return self._store.get(key, default)

def __contains__(self, key):
return key in self._store

def __iter__(self):
return iter(self._store)

Expand Down
6 changes: 6 additions & 0 deletions conda_rpms/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ rpm:

install:
prefix: '/opt/scitools'

taggedenv:
summary: 'The {{ name }}-{{ tag }} environment.'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be configured in this way. In general, it should be on a per environment basis.
That said, this would make an excellent default.


env:
summary: 'The {{ name }}-{{ label }} to {{ name }}-{{ tag }} environment.'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

27 changes: 20 additions & 7 deletions conda_rpms/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,37 @@ def render_dist_spec(dist, config):
rpm_prefix=rpm_prefix,
install_prefix=install_prefix)


def render_env(branch_name, label, repo, config, tag, commit_num):
env_info = {'url': 'http://link/to/gh',
'name': branch_name,
summary = None
if 'env' in config:
summary = config['env'].get('summary')
if summary is None:
summary = 'The {{name}}-{{label}} to {{name}}-{{tag}} environment.'
labelled_tag = tag.split('-')[-1]
summary = env.from_string(summary).render(name=branch_name, label=label,
tag=labelled_tag)
env_info = {'name': branch_name,
'label' : label,
'summary': 'A SciTools environment.',
'summary': summary,
'version': commit_num,}
install_prefix = config['install']['prefix']
rpm_prefix = config['rpm']['prefix']
return env_spec_tmpl.render(install_prefix=install_prefix,
rpm_prefix=rpm_prefix, env=env_info,
labelled_tag=tag.split('-')[-1])
labelled_tag=labelled_tag)


def render_taggedenv(env_name, tag, pkgs, config, env_spec):
env_info = {'url': 'http://link/to/gh',
'name': env_name,
summary = None
if 'taggedenv' in config:
summary = config['taggedenv'].get('summary')
if summary is None:
summary = 'The {{ name }}-{{ tag }} environment.'
summary = env.from_string(summary).render(name=env_name, tag=tag)
env_info = {'name': env_name,
'tag': tag,
'summary': 'An environment in which to rejoice.',
'summary': summary,
'version': '1',
'spec': '\n'.join(env_spec)}
rpm_prefix = config['rpm']['prefix']
Expand Down