Thanks to visit codestin.com
Credit goes to github.com

Skip to content

separate 32bit and 64bit changelogs #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ def diff_package_dicts(dict1_in, dict2_in):
return text


def find_closer_version(version1, basedir=None, flavor=''):
def find_closer_version(version1, basedir=None, flavor='', architecture=64):
"""Find version which is the closest to `version`"""
builddir = osp.join(basedir, 'build%s' % flavor)
func = lambda name: re.match(r'WinPython%s-([0-9\.]*)\.(txt|md)' % flavor, name)
func = lambda name: re.match(r'WinPython%s-%sbit-([0-9\.]*)\.(txt|md)' %
(flavor, architecture), name)
versions = [func(name).groups()[0]
for name in os.listdir(builddir) if func(name)]
try:
Expand All @@ -165,16 +166,17 @@ def find_closer_version(version1, basedir=None, flavor=''):


def compare_package_indexes(version2, version1=None, basedir=None, flavor='',
flavor1=None):
flavor1=None, architecture=64):
"""Compare two package index Wiki pages"""
if version1 is None:
version1 = find_closer_version(version2, basedir=basedir,
flavor=flavor)
flavor=flavor, architecture=architecture)
flavor1 = flavor1 if flavor1 is not None else flavor
text = '\r\n'.join(["## History of changes for WinPython %s" %
(version2+flavor),
"", "The following changes were made to WinPython "
"distribution since version %s." % (version1+flavor1),
text = '\r\n'.join(["## History of changes for WinPython-%sbit %s" %
(architecture, version2+flavor),
"", "The following changes were made to WinPython-%sbit"
" distribution since version %s." % (architecture,
version1+flavor1),
"", ""])
pi1 = PackageIndex(version1, basedir=basedir, flavor=flavor1)
pi2 = PackageIndex(version2, basedir=basedir, flavor=flavor)
Expand All @@ -188,24 +190,25 @@ def compare_package_indexes(version2, version1=None, basedir=None, flavor='',
return text


def _copy_all_changelogs(version, basedir, flavor=''):
def _copy_all_changelogs(version, basedir, flavor='', architecture=64):
basever = '.'.join(version.split('.')[:2])
for name in os.listdir(CHANGELOGS_DIR):
if re.match(r'WinPython%s-%s([0-9\.]*)\.(txt|md)' %
(flavor, basever), name):
if re.match(r'WinPython%s-%sbit-%s([0-9\.]*)\.(txt|md)' %
(flavor, architecture, basever), name):
shutil.copyfile(osp.join(CHANGELOGS_DIR, name),
osp.join(basedir, 'build%s' % flavor, name))


def write_changelog(version2, version1=None, basedir=None, flavor='',
release_level=''):
release_level='', architecture=64):
"""Write changelog between version1 and version2 of WinPython"""
_copy_all_changelogs(version2, basedir, flavor=flavor)
print ('comparing_package_indexes', version2, basedir, flavor)
_copy_all_changelogs(version2, basedir, flavor=flavor, architecture=architecture)
print ('comparing_package_indexes', version2, basedir, flavor, architecture)
text = compare_package_indexes(version2, version1, basedir=basedir,
flavor=flavor)
flavor=flavor, architecture=architecture)
fname = osp.join(basedir, 'build%s' % flavor,
'WinPython%s-%s_History.md' % (flavor, version2))
'WinPython%s-%sbit-%s_History.md' % (flavor, architecture,
version2))
with open(fname, 'w', encoding='utf-8-sig') as fdesc: # python 3 need
fdesc.write(text)
# Copy to winpython/changelogs
Expand All @@ -226,8 +229,9 @@ def test_parse_package_index_wiki(version, basedir=None, flavor=''):
print('')


def test_compare(basedir, version2, version1):
print(compare_package_indexes(basedir, version2, version1))
def test_compare(basedir, version2, version1, architecture=64):
print(compare_package_indexes(basedir, version2, version1,
architecture=architecture))


if __name__ == '__main__':
Expand Down
11 changes: 7 additions & 4 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def get_tool_path(relpath, checkfunc):
python_desc = 'Python programming language with standard library'
return """## WinPython %s

The following packages are included in WinPython v%s%s.
The following packages are included in WinPython-%s v%s%s.

### Tools

Expand All @@ -190,7 +190,7 @@ def get_tool_path(relpath, checkfunc):
Name | Version | Description
-----|---------|------------
[Python](http://www.python.org/) | %s | %s
%s""" % (self.winpyver2+self.flavor, self.winpyver2+self.flavor,
%s""" % (self.winpy_arch, self.winpyver2+self.flavor, self.winpyver2+self.flavor,
(' %s' % self.release_level), '\n'.join(tools),
self.python_fullversion, python_desc, '\n'.join(packages))

Expand Down Expand Up @@ -1181,9 +1181,11 @@ def make(self, remove_existing=True, requirements=None, my_winpydir=None): #, f
# Writing package index
self._print("Writing package index")
# winpyver2 = need the version without build part
# but with self.distribution.architecture
self.winpyver2 = '%s.%s' % (self.python_fullversion, self.build_number)
fname = osp.join(self.winpydir, os.pardir,
'WinPython%s-%s.md' % (self.flavor, self.winpyver2))
'WinPython%s-%sbit-%s.md' % (self.flavor,
self.distribution.architecture, self.winpyver2))
open(fname, 'w').write(self.package_index_wiki)
# Copy to winpython/changelogs
shutil.copyfile(fname, osp.join(CHANGELOGS_DIR, osp.basename(fname)))
Expand All @@ -1192,7 +1194,8 @@ def make(self, remove_existing=True, requirements=None, my_winpydir=None): #, f
# Writing changelog
self._print("Writing changelog")
diff.write_changelog(self.winpyver2, basedir=self.basedir,
flavor=self.flavor, release_level=self.release_level)
flavor=self.flavor, release_level=self.release_level,
architecture=self.distribution.architecture)
self._print_done()


Expand Down