ntoll / uflash

A module and command to easily flash Python onto the BBC's micro:bit device.
http://micropython.org/
MIT License
101 stars 27 forks source link

Make this work with Python 2. #4

Closed ntoll closed 8 years ago

ntoll commented 8 years ago

What it says on the tin.

funkyHat commented 8 years ago

It's a pain that it's not possible to specify platform-specific dependencies in requirements.txt

Looks like we're missing at least mock and builtins (from the future distribution) that could easily be specified as a dependency for pip to fetch, but it would be annoying to clutter up a python3 install with them unnecessarily...

What do you think about creating a separate requirements file for python2?

funkyHat commented 8 years ago

https://github.com/funkyHat/uflash/tree/python2 Not quite working yet, the hex output is subtly different. The only tests that are failing are test_unhexlify and test_extract, but they are failing because the output from hexlify is different.

Perhaps we need more tests to ensure the output from hexlify is correct?

(The actual difference is an extraneous 4 on a line on its own at the end of the embedded python script (at least for our current TESTSCRIPT :) :) ) so it wouldn't actually break anything << )

funkyHat commented 8 years ago

There's a new requirements file just for python 2, can setuptools be configured to grab dependencies from there too if it's on python 2?

funkyHat commented 8 years ago

I found a nice solution to this: https://caremad.io/2013/07/setup-vs-requirement/ requirements.txt can contain a line like '-e .' and it will look for dependencies inside setup.py. That allows me to check the python version there and just feels neater overall :)

ntoll commented 8 years ago

Nice spot! ;-)

funkyHat commented 8 years ago

The problem I have now is Python 2 is resisting my efforts to mock open ... (and still the problem where hexlify is generating subtly different output)

funkyHat commented 8 years ago

Ah. Apparently I should have put "fixes #4" instead of "fixes issue #4" in order for github to automatically close this :)

tomviner commented 8 years ago

This issue can be closed now? I'm adding tox and travis-ci so we can be sure it's still working on Python 2.7, (and 3.3, 3.4, 3.5).

funkyHat commented 8 years ago

Yep :)