Skip to content

Commit

Permalink
Added kludge to work around setuptools bug
Browse files Browse the repository at this point in the history
The setuptools module is introducing newlines into PKG-INFO. Added a
kludge script to handle all the prep-work for registering the package,
including dealing with this issue.
  • Loading branch information
hosford42 committed May 27, 2015
1 parent 9e8a8b0 commit a77ba1e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ input, and attempts to select the best action from a predetermined list
of choices using an evolving set of rules that match inputs and offer
appropriate suggestions. It then receives a reward signal indicating the
quality of its decision, which it uses to adjust the rule set that was
used to make the decision. This process is then repeated, allowing the
algorithm to evaluate the changes it has already made and further refine
the rule set.
used to make the decision. This process is subsequently repeated,
allowing the algorithm to evaluate the changes it has already made and
further refine the rule set.

A key feature of XCS is that, unlike many other machine learning
algorithms, it not only learns the optimal input/output mapping, but
Expand Down
29 changes: 29 additions & 0 deletions register_prep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Prepares for registration.
__author__ = 'Aaron Hosford'

import glob
import os

from xcs import __version__
import build_readme

build_readme.build_readme()
os.system('python setup.py sdist bdist_wheel')

with open('xcs.egg-info/PKG-INFO', encoding='utf-8', mode='rU') as infile:
with open('xcs.egg-info/PKG-INFO-FIXED', encoding='utf-8', mode='w') as outfile:
prev_skipped = False
for line in infile:
if line.strip() or prev_skipped:
outfile.write(line)
prev_skipped = False
else:
prev_skipped = True
os.remove('xcs.egg-info/PKG-INFO')
os.rename('xcs.egg-info/PKG-INFO-FIXED', 'xcs.egg-info/PKG-INFO')

dist = glob.glob('dist\\*' + __version__ + '*.whl')[-1]
print(dist)
os.system('pip install dist\\' + os.path.basename(dist) + ' --upgrade')


2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# Get the long description from the relevant file. First try README.rst, then fall back on
# the default string defined here in this file.
if path.isfile(path.join(here, 'README.rst')):
with open(path.join(here, 'README.rst'), encoding='utf-8') as description_file:
with open(path.join(here, 'README.rst'), encoding='utf-8', mode='rU') as description_file:
long_description = description_file.read()

setup(
Expand Down

0 comments on commit a77ba1e

Please sign in to comment.