1313from __future__ import print_function , with_statement
1414
1515import os
16- # import os.path as osp
1716from pathlib import Path
1817import re
1918import shutil
2524def normalize (name ):
2625 return re .sub (r"[-_.]+" , "-" , name ).lower ()
2726
28- # CHANGELOGS_DIR = osp.join(
29- # osp.dirname(__file__), 'changelogs'
30- # )
3127CHANGELOGS_DIR = str (Path (__file__ ).parent / 'changelogs' )
32- # assert osp.isdir(CHANGELOGS_DIR)
3328assert Path (CHANGELOGS_DIR ).is_dir ()
3429
3530
@@ -111,16 +106,6 @@ def __init__(
111106 self .from_file (basedir )
112107
113108 def from_file (self , basedir ):
114- # fname = osp.join(basedir, 'build%s' % self.flavor,
115- #fname = osp.join(
116- # CHANGELOGS_DIR,
117- # 'WinPython%s-%sbit-%s.md'
118- # % (
119- # self.flavor,
120- # self.architecture,
121- # self.version,
122- # ),
123- #)
124109 fname = str (Path (CHANGELOGS_DIR ) /
125110 f'WinPython{ self .flavor } -{ self .architecture } bit-{ self .version } .md' )
126111
@@ -214,7 +199,6 @@ def find_closer_version(
214199 version1 , basedir = None , flavor = '' , architecture = 64
215200):
216201 """Find version which is the closest to `version`"""
217- # builddir = osp.join(basedir, 'bu%s' % flavor)
218202 builddir = str (Path (basedir ) / f'bu{ flavor } ' )
219203 func = lambda name : re .match (
220204 r'WinPython%s-%sbit-([0-9\.]*)\.(txt|md)'
@@ -311,9 +295,7 @@ def _copy_all_changelogs(
311295 name ,
312296 ):
313297 shutil .copyfile (
314- # osp.join(CHANGELOGS_DIR, name),
315298 str (Path (CHANGELOGS_DIR ) / name ),
316- # osp.join(basedir, 'bu%s' % flavor, name),
317299 str (Path (basedir ) / f'bu{ flavor } ' / name ),
318300 )
319301
@@ -347,12 +329,6 @@ def write_changelog(
347329 flavor = flavor ,
348330 architecture = architecture ,
349331 )
350- #fname = osp.join(
351- # basedir,
352- # 'bu%s' % flavor,
353- # 'WinPython%s-%sbit-%s_History.md'
354- # % (flavor, architecture, version2),
355- #)
356332 fname = str (Path (basedir ) /
357333 f'bu{ flavor } ' /
358334 f'WinPython{ flavor } -{ architecture } bit-{ version2 } _History.md' )
@@ -364,7 +340,6 @@ def write_changelog(
364340 fdesc .write (text )
365341 # Copy to winpython/changelogs
366342 shutil .copyfile (
367- #fname, osp.join(CHANGELOGS_DIR, osp.basename(fname))
368343 fname , str (Path (CHANGELOGS_DIR ) / Path (fname ).name )
369344 )
370345
0 commit comments