Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure the leading dollar-sign is printed when unmatched labels are f…

…ound.
  • Loading branch information...
commit 645258be34e58024d74732974ebff528041364a0 1 parent 8d6e3bf
@fish2000 authored
Showing with 7 additions and 9 deletions.
  1. +1 −1  MANIFEST.in
  2. +1 −1  setup.py
  3. +5 −7 src/viron/viron.py
View
2  MANIFEST.in
@@ -1,5 +1,5 @@
include .gitignore
include README.md
include setup.py
-recursive-include src *.py
+recursive-include src/viron *.py
View
2  setup.py
@@ -22,7 +22,7 @@
import sys
name = 'viron'
-version = '0.3.2'
+version = '0.3.3'
packages = []
description = 'Put environment variables in text file templates.'
keywords = 'python environment variable simple template text'
View
12 src/viron/viron.py
@@ -50,15 +50,13 @@ def viron(swaptext, swapdic=os.environ, ignoreseq=tuple(),
matcher = r'(?<!\\)\${1}([A-Z][A-Z0-9_]+)'
bracedmatcher = r'(?<!\\)\${1}\{([A-Z][A-Z0-9_]+)\}'
- swapmapper = lambda en: en and (en, swapdic.get(en, en)) or ''
+ swapmapper = lambda en: en and (en, swapdic.get(en, "$%s" % en)) or ''
swapfilter = lambda ex: ex and not (ex in ignoreseq)
- envs = dict(map(swapmapper,
- filter(swapfilter,
- re.compile(matcher).findall(swaptext))))
- envs.update(dict(map(swapmapper,
- filter(swapfilter,
- re.compile(bracedmatcher).findall(swaptext)))))
+ envs = dict(map(swapmapper, filter(swapfilter,
+ re.compile(matcher).findall(swaptext))))
+ envs.update(dict(map(swapmapper, filter(swapfilter,
+ re.compile(bracedmatcher).findall(swaptext)))))
strays = set(envs.keys()).difference(swapdic.keys())
Please sign in to comment.
Something went wrong with that request. Please try again.