Package platformids ::
        Package custom ::
        Module blackarch
      
  1   
  2  """BlackArch Linux releases. 
  3   
  4  Here *BlackArch* Linux, which has the same encoding as *ArchLinux*. 
  5   
  6  """ 
  7  from __future__ import absolute_import 
  8   
  9  from platformids import RTE, rte2num, num2rte, num2pretty, custom_rte_distrel2tuple, custom_dist, \ 
 10      PlatformIDsUnknownError, \ 
 11      RTE_LINUX, RTE_DISTEXT, RTE_OSTYPE, RTE_DIST 
 12   
 13   
 14  __author__ = 'Arno-Can Uestuensoez' 
 15  __license__ = "Artistic-License-2.0 + Forced-Fairplay-Constraints" 
 16  __copyright__ = "Copyright (C) 2010-2018 Arno-Can Uestuensoez" \ 
 17                  " @Ingenieurbuero Arno-Can Uestuensoez" 
 18  __version__ = '0.1.1' 
 19  __uuid__ = "7add5ded-c39b-4b6e-8c87-1b3a1c150ee9" 
 20   
 21   
 22  RTE_BLACKARCH        = RTE_LINUX      + custom_dist.add_enum()    
 23  RTE_BLACKARCH20180   = RTE_BLACKARCH  + 0x00006000                             
 24   
 25       
 26   
 27  rte2num.update( 
 28      { 
 29          'blackarch':               RTE_BLACKARCH, 
 30          'blackarch20180':          RTE_BLACKARCH20180, 
 31          RTE_BLACKARCH:             RTE_BLACKARCH, 
 32          RTE_BLACKARCH20180:        RTE_BLACKARCH20180, 
 33      } 
 34  ) 
 35   
 36   
 37   
 38  num2rte.update( 
 39      { 
 40          RTE_BLACKARCH:             'blackarch', 
 41          RTE_BLACKARCH20180:        'blackarch20180', 
 42      } 
 43  ) 
 44   
 45   
 46  num2pretty.update( 
 47      { 
 48          RTE_BLACKARCH:             'BlackArch', 
 49          RTE_BLACKARCH20180:        'BlackArch-2018.0', 
 50      } 
 51  ) 
 52   
 54      """Callback for special version layout of BlackArch Linux, the 
 55      same as ArchLinux by Rolling-Versioning, see manuals.  
 56       
 57      A callback to be used by the function: 
 58       
 59         platformids.decode_rte_distrel_to_segments(rte=RTE) 
 60       
 61      Decodes the compressed *distrel* from the 32bit integer 
 62      bitmask *rte* into the corresponding tuple of integer 
 63      segments. 
 64   
 65     Args: 
 66         rte: 
 67             The comppressed runtime environment identifier bitmask. 
 68               
 69             default := RTE 
 70   
 71     Returns: 
 72         Tuple of Integer values of the encoded segments, either 
 73         as defined by the default layout, or any known as defined 
 74         by additional extended and/or custom criteria. 
 75       
 76     Raises: 
 77         pass-through 
 78   
 79     Examples: 
 80       :: 
 81   
 82          decode_rte_distrel_to_segments()      
 83          =>  (2019, 4, 1)     # on BlackArch-2019.4.1 
 84   
 85      """ 
 86      if rte & RTE_DIST != RTE_BLACKARCH: 
 87          raise PlatformIDsUnknownError("Not BlackArch:  rte = " + str(rte)) 
 88           
 89      try: 
 90           
 91          _rte = rte2num[rte] 
 92      except KeyError: 
 93           
 94           
 95          if type(rte) is int: 
 96               
 97              _rte = rte 
 98   
 99          else: 
100              raise PlatformIDsUnknownError("Unknown BlackArch release rte = " + str(rte)) 
101   
102       
103      return ( 
104          (_rte & 0xfe00) >> 9 + 1970,  
105          (_rte & 0x01e0) >> 5,  
106          _rte & 0x001f,  
107          ) 
 108   
109   
110   
111  custom_rte_distrel2tuple.update( 
112      { 
113           
114           
115          RTE_BLACKARCH: my_distrel2tuple,   
116      } 
117  ) 
118