Skip to content

Commit

Permalink
Fix project install against Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
kxepal committed Jun 17, 2018
1 parent d7f73d2 commit 911d39e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/setuptools-egg_info.build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Workaround https://github.com/pypa/setuptools/issues/1136
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import subprocess

from setuptools import setup
from setuptools.command.egg_info import egg_info as egg_info_orig
from setuptools.command.sdist import sdist as sdist_orig


Expand All @@ -30,6 +31,7 @@
def main():
return setup(
cmdclass={
'egg_info': egg_info,
'sdist': sdist,
},
version=project_version(),
Expand Down Expand Up @@ -69,6 +71,18 @@ def project_version():
return version


class egg_info(egg_info_orig):

def _ensure_stringlike(self, option, what, default=None):
val = getattr(self, option)
if val is None:
setattr(self, option, default)
return default
elif isinstance(val, (type(''), type(u''))):
return val
return egg_info_orig._ensure_stringlike(self, option, what, default)


class sdist(sdist_orig):
def run(self):
# In case when user didn't eventually run `make version` ensure that
Expand Down

0 comments on commit 911d39e

Please sign in to comment.