asottile-archive / future-fstrings

A backport of fstrings to python<3.6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python setup.py install doesn't work

dahluwalia-ag opened this issue · comments

Great tool, love the ability to allow fstrings in python2.7!

I noticed a wierd corner case...

Broken example:

  • Using a python 2.7.15 environment, build my custom "aperio" package, which uses future_fstrings (package_requires=['future-fstrings', etc])
  • python setup.py sdist
  • Change into a different python 2.7.15 environment and install my package
  • tar -zxf mypackage.tar.gz
  • cd mypackage
  • python setup.py install
  • launch python and import my package (in caching_setup.py I'm using your fstring hook)
>>> import aperio.common3.caching_lib.caching_setup
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/.local/share/virtualenvs/ex-caching-27-abxQ8rec/lib/python2.7/site-packages/aperioCommon-2.5.12-py2.7.egg/aperio/common3/caching_lib/caching_setup.py", line 14, in <module>
    from aperio.common3.caching_lib.cache_enabled_mixin import CacheEnabledMixin
  File "/root/.local/share/virtualenvs/ex-caching-27-abxQ8rec/lib/python2.7/site-packages/aperioCommon-2.5.12-py2.7.egg/aperio/common3/caching_lib/cache_enabled_mixin.py", line 1
SyntaxError: encoding problem: future_fstrings
>>> import future_fstrings
>>> future_fstrings
<module 'future_fstrings' from '/root/.local/share/virtualenvs/ex-caching-27-abxQ8rec/lib/python2.7/site-packages/**future_fstrings-0.4.4-py2.7.egg/future_fstrings.py**'>

Working example:

  • instead of using python setup.py install, use pip to install my built aperio package
  • cd mypackage
  • pip install .
- launch python and import my package: no problem!
>>> import aperio.common3.caching_lib.caching_setup
>>> import future_fstrings
>>> future_fstrings
<module 'future_fstrings' from '/root/.local/share/virtualenvs/ex-caching-27-abxQ8rec/lib/python2.7/**site-packages/future_fstrings.pyc**'>

Not really a problem since I now know how to workaround the issue...but was confusing and maybe you can fix the setup.py install issue. Note the bolded text...the problem appears when future_fstrings comes from egg...

The other workaround: after the procedure as documented in the broken case, simply reinstall future-fstrings: "pip install future-fstrings --force"...and then it works. And the future_fstrings package will be in the same location as in the working example (not from the egg).

easy_install and eggs are very very very much dead, don't use them. always use pip install to install python things. python setup.py install should never ever be used.