File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1- from  packaging .version  import  Version 
2- 
31import  libtmux 
4- from  libtmux .common  import  get_version 
2+ from  libtmux .common  import  Version ,  get_version 
53
64from  .__about__  import  __version__ 
75from  .exc  import  TmuxpPluginException 
Original file line number Diff line number Diff line change 66""" 
77import  logging 
88import  os 
9+ import  re 
910import  shlex 
1011import  subprocess 
1112import  sys 
1920
2021PY2  =  sys .version_info [0 ] ==  2 
2122
23+ version_component_re  =  re .compile (r"(\d+|[a-z]+|\.)" )
24+ 
25+ 
26+ def  get_version_tuple (version ):
27+     """ 
28+     Return a tuple of version numbers (e.g. (1, 2, 3)) from the version 
29+     string (e.g. '1.2.3'). 
30+     Credit: Django, License: MIT 
31+     https://github.com/django/django/blob/dc9deea/django/utils/version.py#L99 
32+     """ 
33+     version_numbers  =  []
34+     for  item  in  version_component_re .split (version ):
35+         if  item  and  item  !=  "." :
36+             try :
37+                 component  =  int (item )
38+             except  ValueError :
39+                 break 
40+             else :
41+                 version_numbers .append (component )
42+     return  tuple (version_numbers )
43+ 
2244
2345def  run_before_script (script_file , cwd = None ):
2446    """Function to wrap try/except for subprocess.check_call().""" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments