Permalink
Browse files

[OpenWrt] Minor regexp optimization for generate method

  • Loading branch information...
nemesisdesign committed Feb 16, 2016
1 parent d6f2674 commit 6ec5ce85f153b0aa17cb1b9074d6c267953ac671
Showing with 2 additions and 1 deletion.
  1. +2 −1 netjsonconfig/backends/openwrt/openwrt.py
@@ -26,6 +26,7 @@ class OpenWrt(object):
renderers.DefaultRenderer
]
FILE_SECTION_DELIMITER = '# ---------- files ---------- #'
PACKAGE_EXP = re.compile('package ')
def __init__(self, config, templates=[]):
"""
@@ -173,7 +174,7 @@ def _generate_contents(self, tar):
"""
uci = self.render(files=False)
# create a list with all the packages (and remove empty entries)
packages = re.split('package ', uci)
packages = self.PACKAGE_EXP.split(uci)
if '' in packages:
packages.remove('')
# for each package create a file with its contents in /etc/config

0 comments on commit 6ec5ce8

Please sign in to comment.