forked from enthought/comtypes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for "pip install comtypes" (reproduce enthought#155).
- Loading branch information
1 parent
8729d30
commit cf1a549
Showing
2 changed files
with
26 additions
and
0 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
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,24 @@ | ||
import os | ||
import sys | ||
import subprocess | ||
|
||
def read_version(): | ||
# Determine the version number by reading it from the file | ||
# 'comtypes\__init__.py'. We cannot import this file (with py3, | ||
# at least) because it is in py2.x syntax. | ||
ns = {} | ||
for line in open("comtypes/__init__.py"): | ||
if line.startswith("__version__ = "): | ||
var, value = line.split('=') | ||
return value.strip().strip('"').strip("'") | ||
raise NotImplementedError("__version__ is not found in __init__.py") | ||
|
||
# prepare the same package that is usually uploaded to PyPI | ||
subprocess.check_output([sys.executable, 'setup.py', 'sdist', '--format=zip']) | ||
|
||
filename_for_upload = 'comtypes-{}.zip'.format(read_version()) | ||
target_package = os.path.join(os.getcwd(), 'sdist', filename_for_upload) | ||
|
||
# run "pip install comtypes-x.y.z.zip" | ||
pip_exe = os.path.join(os.path.dirname(sys.executable), 'Scripts', 'pip.exe') | ||
subprocess.check_output([pip_exe, 'install', target_package]) |