pfalcon / ScratchABlock

Yet another crippled decompiler project
https://github.com/EiNSTeiN-/decompiler/issues/9#issuecomment-103221200
GNU General Public License v3.0
104 stars 23 forks source link

Python version in Travis #15

Closed maximumspatium closed 6 years ago

maximumspatium commented 6 years ago

I just noticed that the latest Travis tests run under Python 2.7, see below:

travis_time:end:0c860484:start=1515153979134553019,finish=1515153990302226824,duration=11167673805
travis_fold:end:apt
travis_time:start:22ca0db5
$ source ~/virtualenv/python2.7/bin/activate

travis_time:end:22ca0db5:start=1515153998619342051,finish=1515153998628880569,duration=9538518
$ python --version
Python 2.7.14
$ pip --version
pip 9.0.1 from /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (python 2.7)
travis_fold:start:install
travis_time:start:0d7a13c2
$ pip install -r requirements.txt
Collecting pyyaml (from -r requirements.txt (line 1))
  Downloading PyYAML-3.12.tar.gz (253kB)

Is it supposed to work this way or am I missing something?

pfalcon commented 6 years ago

Where do you see that exactly? At https://travis-ci.org/pfalcon/ScratchABlock/builds/325232090, next is:

=== test_unit ===
python3 -m nose version 1.3.1
test_dom.test_cooper_9_2_1 ... ok
...

The testsuite won't run with python2 (you can try). The rest is apparently Travis magic. E.g. if it detects there's requirements.txt in the repo, it automagically runs pip against it without being asked to. But again, on any non-orthodox system, "pip" is "pip2".

Anyway, yesterday I pushed further cleanups which allow to install stuff using pip. The only requirement is that there's "python3" executable in PATH. I didn't try to switch Travis to it though.

maximumspatium commented 6 years ago

Where do you see that exactly?

Look at the lines 469, 471 and 472 of your Travis log. There I see:

$ python --version
Python 2.7.14
maximumspatium commented 6 years ago

It seems to work, yes, magically. Anyway, it doesn't look correct to me. That's why I had these two lines in .travis.yml:

language: python
python:
  - "3.4"
pfalcon commented 6 years ago

We don't use "python", we use "python3". Otherwise:

The rest is apparently Travis magic.

(That includes running python --version.)

All in all, CI has got to be hard and confusing, it's unimaginable to make it otherwise ;-). Even "conveniences" like above turn into mis-conveniences in real use ;-).

My concern is to make/keep SABl being easily installable, including for people not much familiar with Python (in particular, with python2/python3 drama). In that regard, testing in Travis what would be used be real user is a right choice IMHO. And this is an improvement too, beyond just Debian-world: https://github.com/pfalcon/ScratchABlock/commit/3985a94f6b9a4a2c745b61cc02a113b252443228

pfalcon commented 6 years ago

It seems to work, yes, magically.

No magic, pure down-to-earth technology of nowadays :-I

maximumspatium commented 6 years ago

Alright. Closing this issue because the tests are actually working.

pfalcon commented 6 years ago
python:
  - "3.4"

Let's nail it down fully: the above installs non-distro py3.4 archive somewhere in /travis/blah/blah and adds it to PATH. But that misses some important commands, e.g. pip3. So, when you run pip3, it runs pip3 from distro package, which install stuff under system path (/usr/lib), not under /travis/blah/blah. Then Travis' adhoc py3.4 can't find it, what you saw, etc. etc.

So, as I mentioned, my preference would be to emulate a real user's action during testing, which is IMHO using system packages. Yes, that limits testing to a particular distro, but you can't test all at once anyway.

BUT, with the latest changes, it should also work with pip-based install (e.g. on Windows), as long as there's python3 executable is available - which is the last straw I don't want to test whether Travis provides for its adhoc stuff or not ;-).