Skip to content

Commit 93a4c9e

Browse files
committed
Fixed versioning for building distros
1 parent daf5752 commit 93a4c9e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

build_rules.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@
2828
lock_files, unlock_files, delete_directory, create_setup_py, \
2929
delete_file
3030

31+
# Buildme and Cleanme are invoked from another folder
32+
# so Python will pull in the version of wslwinreg that's
33+
# already installed. To force it to use the one in this
34+
# folder, manually purge it first, then insert the current
35+
# working directory into the search path, then reload
36+
# with the import call
37+
38+
# Remove old copy of wslwinreg
39+
if "wslwinreg" in sys.modules:
40+
del sys.modules["wslwinreg"]
41+
42+
# Update the path
43+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
44+
45+
# Import this copy of wslwinreg
46+
# pylint: disable=wrong-import-position
3147
from wslwinreg import __version__
3248

3349
# If set to True, ``buildme -r``` will not parse directories in this folder.
@@ -42,7 +58,6 @@
4258
# ``cleanme`` will clean the listed folders before cleaning this folder.
4359
CLEANME_DEPENDENCIES = ["src"]
4460

45-
4661
# Directories to clean
4762
CLEAN_DIR_LIST = [
4863
"wslwinreg.egg-info",
@@ -89,6 +104,7 @@ def build(working_directory, configuration):
89104
None if not implemented, otherwise an integer error code.
90105
"""
91106

107+
# Create setup.py for Python 2.7 distribution
92108
input_file = os.path.join(working_directory, "pyproject.toml")
93109
output_file = os.path.join(working_directory, "setup.py")
94110
create_setup_py(input_file, output_file)

0 commit comments

Comments
 (0)