• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Juniper / jsnapy / 297
91%

Build:
DEFAULT BRANCH: master
Ran 31 Jan 2020 04:08AM UTC
Jobs 5
Files 44
Run time 21s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
297

push

travis-ci

web-flow
Update setup.py to support MacOS Python 3.X (#353)

* Update setup.py

I've noticed that this setup.py does not work when trying to execute
"pip install jsnapy" from a Python 3.X Virtual environment.

It appears that Python 3.X does not use the sys.real_prefix attribute any more.
I found some documentation here https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv showing that it is moved to base_prefix.

What i've added will check sys.base_prefix and compare it to sys.prefix, if it doesn't match, than you're in a virtual environment. 

Outside of VirtualEnv;

Gian-Lucas-MacBook-Pro:~ gianluca.casella$ python3.8
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.base_prefix
'/Library/Frameworks/Python.framework/Versions/3.8'
>>> sys.prefix
'/Library/Frameworks/Python.framework/Versions/3.8'
>>> quit()



Inside VirtualEnv:
Gian-Lucas-MacBook-Pro:~ gianluca.casella$ source venv/bin/activate
(venv) Gian-Lucas-MacBook-Pro:~ gianluca.casella$ python
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.base_prefix
'/Library/Frameworks/Python.framework/Versions/3.8'
>>> sys.prefix
'/Users/gianluca.casella/venv'

* Update setup.py

Updated typo on 

hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))

* Update setup.py

Added line 75

* Update __init__.py

Modified line 29 to enable Python 3.X Support in Virtual Environments

* Update test_init.py

Modified line 39 to add Python 3.X Support for Virtual Environments

* Added the venv_check() function to the setup.py and lib/jnpr/jsnapy/__init__.py

10504 of 11374 relevant lines covered (92.35%)

0.92 hits per line

Jobs
ID Job ID Ran Files Coverage
1 297.1 31 Jan 2020 04:08AM UTC 0
92.4
Travis Job 297.1
2 297.2 31 Jan 2020 04:08AM UTC 0
92.33
Travis Job 297.2
3 297.3 31 Jan 2020 04:08AM UTC 0
92.33
Travis Job 297.3
4 297.4 31 Jan 2020 04:08AM UTC 0
92.33
Travis Job 297.4
5 297.5 31 Jan 2020 04:08AM UTC 0
92.34
Travis Job 297.5
Source Files on build 297
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #297
  • 8b417e20 on github
  • Prev Build on master (#285)
  • Next Build on master (#300)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc