Skip to content

Commit ac51bb7

Browse files
chrisjbillingtondihm
authored andcommitted
Merge pull request #91 from labscript-suite/pep660-fix
Include labscript-suite.pth in editable wheels
1 parent b990539 commit ac51bb7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

setup.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,25 @@
33
from setuptools.command.develop import develop
44
import logging
55

6+
# Setupstools >=64
7+
try:
8+
from setuptools.command.editable_wheel import editable_wheel
9+
except ImportError:
10+
editable_wheel_command = None
11+
else:
12+
from wheel.wheelfile import WheelFile
613

14+
class editable_wheel_command(editable_wheel):
15+
"""Custom editable_wheel command which installs the .pth file to the
16+
wheel file for editable installs."""
17+
def _create_wheel_file(self, bdist_wheel):
18+
wheel_path = super()._create_wheel_file(bdist_wheel)
19+
with WheelFile(wheel_path, 'a') as wheel:
20+
wheel.write("labscript-suite.pth")
21+
return wheel_path
22+
23+
24+
# Setuptools <= 63:
725
class develop_command(develop):
826
"""Custom develop command which installs the .pth file to site-packages for editable
927
installs."""
@@ -21,4 +39,10 @@ def run(self):
2139
"local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"),
2240
}
2341

24-
setup(use_scm_version=VERSION_SCHEME, cmdclass={'develop': develop_command})
42+
setup(
43+
use_scm_version=VERSION_SCHEME,
44+
cmdclass={
45+
'develop': develop_command,
46+
'editable_wheel': editable_wheel_command,
47+
},
48+
)

0 commit comments

Comments
 (0)