-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding source as binding platform + version for tracing through the i…
…nfrastructure. Separating version into a separate readable file to follow canonical Python packaging practice + relevant unit test. More details in code comments.
- Loading branch information
1 parent
2b85ae3
commit 03df99c
Showing
5 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import version | ||
|
||
# Python modules report to module_name.__version__ with their version | ||
# Ref: https://www.python.org/dev/peps/pep-0008/#module-level-dunder-names | ||
# With this, browserstack.__version__ will respond with <version> | ||
|
||
__version__ = version.__version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "1.2.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
|
||
|
||
# Need to read the single-source-of-truth version file as text | ||
# Importing version_file here can open the door to a cyclic dependency | ||
def get_version(a_path): | ||
with open(a_path, 'r') as version_file: | ||
for a_line in version_file: | ||
if '__version__' in a_line: | ||
# Cleaning up all spaces and quotes around a string of the form __version__ = "x.y.z" | ||
return a_line.split("=")[1].split()[0].replace('"', '').replace("'","") | ||
raise RuntimeError("Unable to find version string.") | ||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
from distutils.core import setup | ||
setup( | ||
name = 'browserstack-local', | ||
packages = ['browserstack'], | ||
version = '1.2.2', | ||
version = get_version("browserstack/version.py"), | ||
description = 'Python bindings for Browserstack Local', | ||
author = 'BrowserStack', | ||
author_email = '[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters