@@ -28,7 +28,7 @@ def parse_date(date_str: str) -> dt.date:
2828class Versions :
2929 """For converting JSON to CSV and SVG."""
3030
31- def __init__ (self , limit_to_active = False ) -> None :
31+ def __init__ (self , limit_to_active = False , special_py27 = False ) -> None :
3232 with open ("include/release-cycle.json" , encoding = "UTF-8" ) as in_file :
3333 self .versions = json .load (in_file )
3434
@@ -47,10 +47,13 @@ def __init__(self, limit_to_active=False) -> None:
4747 for version in self .versions .values ()
4848 if version ["status" ] != 'end-of-life'
4949 )
50+ if special_py27 :
51+ self .cutoff = min (self .cutoff , dt .date (2019 , 8 , 1 ))
5052 self .versions = {
5153 key : version
5254 for key , version in self .versions .items ()
5355 if version ["end_of_life_date" ] >= self .cutoff
56+ or (special_py27 and key == '2.7' )
5457 }
5558 self .id_key = 'active'
5659 else :
@@ -62,6 +65,15 @@ def __init__(self, limit_to_active=False) -> None:
6265 reverse = True ,
6366 )
6467
68+ # Set the row (y-coordinate) for the chart, to allow a gap between 2.7
69+ # and the rest
70+ y = len (self .sorted_versions ) + (1 if special_py27 else 0 )
71+ for version in self .sorted_versions :
72+ if special_py27 and version ["key" ] == '2.7' :
73+ y -= 1
74+ version ["y" ] = y
75+ y -= 1
76+
6577
6678 def write_csv (self ) -> None :
6779 """Output CSV files."""
@@ -139,7 +151,7 @@ def format_year(year: int) -> str:
139151 template .stream (
140152 SCALE = SCALE ,
141153 diagram_width = DIAGRAM_WIDTH ,
142- diagram_height = (len ( self .sorted_versions ) + 2 ) * LINE_HEIGHT ,
154+ diagram_height = (self .sorted_versions [ 0 ][ "y" ] + 2 ) * LINE_HEIGHT ,
143155 years = range (first_date .year , last_date .year + 1 ),
144156 LINE_HEIGHT = LINE_HEIGHT ,
145157 LEGEND_WIDTH = LEGEND_WIDTH ,
@@ -171,7 +183,7 @@ def main() -> None:
171183 versions .write_csv ()
172184 versions .write_svg (args .today , "include/release-cycle-all.svg" )
173185
174- versions = Versions (limit_to_active = True )
186+ versions = Versions (limit_to_active = True , special_py27 = True )
175187 versions .write_svg (args .today , "include/release-cycle.svg" )
176188
177189
0 commit comments