Commits

clach04 committed 40e2c4b

Switch to using a version tuple and generate version string from that.
NOTE only handles numerics, does not handle "alpha", "RC", etc.

Comments (0)

Files changed (1)

poachplatelib/package.py

 [properties]
 author : 'FILL IN'
 email : 'FILL IN'
-version : 0.1
+version : 0.0.1
 """
 
 CONFIG_LOC = os.path.expanduser('~/.config/poachplate.ini')
                                     default='FILL IN')
         self.version = cascade_value(opt=opt, opt_name='version', 
                                     cfg=cfg, cfg_section='properties', cfg_name='version',
-                                    default='0.1')
+                                    default='0.0.1')
+        
+        version_tuple = tuple(map(int, self.version.split('.')))
+        for dummy in range(3 - len(version_tuple)):
+            version_tuple = (0,) + version_tuple
+        self.version_tuple = version_tuple
+
         self.email = cascade_value(opt=opt, opt_name='email', 
                                     cfg=cfg, cfg_section='properties', cfg_name='email',
                                     default='FILL IN')
     def gen_meta(self, script_copyright):
         create_file(fout(os.path.join(self.libname, 'meta.py')), """%(script_copyright)s
 
-__version__ = '%(version)s'
+version_tuple = %(version_tuple)r
+__version__ = '%%d.%%d.%%d' %% version_tuple
 __author__ = '%(author)s'
 __email__ = '%(email)s'
 """ % {'version': self.version,
+       'version_tuple': self.version_tuple,
        'author': self.author,
        'email': self.email,
        'script_copyright': script_copyright})