[gnome-builder/gnome-builder-3-32] templates: fix usage of . in project name



commit f0a2c77469fca04cd826a613361c6edbeebcc315
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 30 14:08:48 2019 -0700

    templates: fix usage of . in project name
    
    Fixes #1012

 src/plugins/meson-templates/meson_templates.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/meson-templates/meson_templates.py b/src/plugins/meson-templates/meson_templates.py
index d2c013562..b920dc827 100644
--- a/src/plugins/meson-templates/meson_templates.py
+++ b/src/plugins/meson-templates/meson_templates.py
@@ -120,10 +120,10 @@ class MesonTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
         scope.get('template').assign_string(self.id)
 
         name = params['name'].get_string().lower()
-        name_ = name.lower().replace('-', '_')
+        name_ = ''.join([c if c.isalnum() else '_' for c in name])
         scope.get('name').assign_string(name)
         scope.get('name_').assign_string(name_)
-        scope.get('NAME').assign_string(name.upper().replace('-','_'))
+        scope.get('NAME').assign_string(name_.upper())
 
         if 'app-id' in params:
             appid = params['app-id'].get_string()
@@ -133,10 +133,10 @@ class MesonTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
         scope.get('appid').assign_string(appid)
         scope.get('appid_path').assign_string(appid_path)
 
-        prefix = name if not name.endswith('-glib') else name[:-5]
-        PREFIX = prefix.upper().replace('-','_')
-        prefix_ = prefix.lower().replace('-','_')
-        PreFix = ''.join([word.capitalize() for word in prefix.lower().split('-')])
+        prefix = name_ if not name_.endswith('_glib') else name_[:-5]
+        PREFIX = prefix.upper()
+        prefix_ = prefix.lower()
+        PreFix = ''.join([word.capitalize() for word in prefix.lower().split('_')])
 
         scope.get('prefix').assign_string(prefix)
         scope.get('Prefix').assign_string(prefix.capitalize())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]