@@ -28,7 +28,7 @@ def parse_date(date_str: str) -> dt.date:
28
28
class Versions :
29
29
"""For converting JSON to CSV and SVG."""
30
30
31
- def __init__ (self , limit_to_active = False ) -> None :
31
+ def __init__ (self , limit_to_active = False , special_py27 = False ) -> None :
32
32
with open ("include/release-cycle.json" , encoding = "UTF-8" ) as in_file :
33
33
self .versions = json .load (in_file )
34
34
@@ -47,10 +47,13 @@ def __init__(self, limit_to_active=False) -> None:
47
47
for version in self .versions .values ()
48
48
if version ["status" ] != 'end-of-life'
49
49
)
50
+ if special_py27 :
51
+ self .cutoff = min (self .cutoff , dt .date (2019 , 8 , 1 ))
50
52
self .versions = {
51
53
key : version
52
54
for key , version in self .versions .items ()
53
55
if version ["end_of_life_date" ] >= self .cutoff
56
+ or (special_py27 and key == '2.7' )
54
57
}
55
58
self .id_key = 'active'
56
59
else :
@@ -62,6 +65,15 @@ def __init__(self, limit_to_active=False) -> None:
62
65
reverse = True ,
63
66
)
64
67
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
+
65
77
66
78
def write_csv (self ) -> None :
67
79
"""Output CSV files."""
@@ -139,7 +151,7 @@ def format_year(year: int) -> str:
139
151
template .stream (
140
152
SCALE = SCALE ,
141
153
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 ,
143
155
years = range (first_date .year , last_date .year + 1 ),
144
156
LINE_HEIGHT = LINE_HEIGHT ,
145
157
LEGEND_WIDTH = LEGEND_WIDTH ,
@@ -171,7 +183,7 @@ def main() -> None:
171
183
versions .write_csv ()
172
184
versions .write_svg (args .today , "include/release-cycle-all.svg" )
173
185
174
- versions = Versions (limit_to_active = True )
186
+ versions = Versions (limit_to_active = True , special_py27 = True )
175
187
versions .write_svg (args .today , "include/release-cycle.svg" )
176
188
177
189
0 commit comments