aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2012-07-16 13:17:20 +0200
committerAndré Erdmann <dywi@mailerd.de>2012-07-16 13:17:20 +0200
commitf5e0ea775cc86046fc424a2c63e9709670a4fe6d (patch)
tree96d2fdbd13ce42a7c60aa7c97994be2e552e1ae4
parentdepresolver: separate run method for threads #2 (diff)
downloadR_overlay-f5e0ea775cc86046fc424a2c63e9709670a4fe6d.tar.gz
R_overlay-f5e0ea775cc86046fc424a2c63e9709670a4fe6d.tar.bz2
R_overlay-f5e0ea775cc86046fc424a2c63e9709670a4fe6d.zip
move fix_ebuild_name to util
-rw-r--r--roverlay/packageinfo.py9
-rw-r--r--roverlay/util.py10
2 files changed, 12 insertions, 7 deletions
diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index cc09a6b..052fad7 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -41,10 +41,6 @@ class PackageInfo ( object ):
config.get_or_fail ( 'R_PACKAGE.suffix_regex' ) + '$'
)
- ILLEGAL_NAME_CHARS = re.compile ( "[.:]{1,}" )
- ILLEGAL_NAME_CHARS_REPLACE_BY = '_'
-
-
def __init__ ( self, **initial_info ):
"""Initializes a PackageInfo.
@@ -308,9 +304,8 @@ class PackageInfo ( object ):
# using pkg_version for the ebuild version
# removing illegal chars from the package_name
- ebuild_name = PackageInfo.ILLEGAL_NAME_CHARS.sub (
- PackageInfo.ILLEGAL_NAME_CHARS_REPLACE_BY, package_name
- )
+ ebuild_name = util.fix_ebuild_name ( package_name )
+
if ebuild_name != package_name:
self ['name'] = ebuild_name
diff --git a/roverlay/util.py b/roverlay/util.py
index f66532a..d658b15 100644
--- a/roverlay/util.py
+++ b/roverlay/util.py
@@ -11,6 +11,16 @@ from roverlay import config
LOGGER = logging.getLogger ( 'util' )
+_EBUILD_NAME_ILLEGAL_CHARS = re.compile ( "[.:]{1,}" )
+_EBUILD_NAME_ILLEGAL_CHARS_REPLACE_BY = '_'
+
+def fix_ebuild_name ( name ):
+ return _EBUILD_NAME_ILLEGAL_CHARS.sub (
+ _EBUILD_NAME_ILLEGAL_CHARS_REPLACE_BY,
+ name
+ )
+# --- end of fix_ebuild_name (...) ---
+
def shorten_str ( s, maxlen, replace_end=None ):
if not replace_end is None:
rlen = maxlen - len ( replace_end )