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

Juniper / jsnapy / 297 / 1
91%
master: 91%

Build:
DEFAULT BRANCH: master
Ran 31 Jan 2020 04:08AM UTC
Files 11
Run time 1s
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

31 Jan 2020 04:06AM UTC coverage: 92.402% (+0.05%) from 92.354%
297.1

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

2627 of 2843 relevant lines covered (92.4%)

0.92 hits per line

Source Files on job 297.1
  • Tree
  • List 0
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 38
  • Travis Job 297.1
  • 8b417e20 on github
  • Prev Job for on master (#285.4)
  • Next Job for on master (#300.1)
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

© 2026 Coveralls, Inc