File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ from setuptools import setup
3
+ from setuptools .command .develop import develop
4
+ import logging
5
+
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
13
+
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:
25
+ class develop_command (develop ):
26
+ """Custom develop command which installs the .pth file to site-packages for editable
27
+ installs."""
28
+ def run (self ):
29
+ path = os .path .join (self .install_dir , 'labscript-suite.pth' )
30
+ super ().run ()
31
+ if not self .uninstall :
32
+ logging .info (f'Copying labscript-suite.pth to { path } ' )
33
+ if not self .dry_run :
34
+ self .copy_file ('labscript-suite.pth' , path )
35
+
36
+ setup (
37
+ cmdclass = {
38
+ 'develop' : develop_command ,
39
+ 'editable_wheel' : editable_wheel_command ,
40
+ },
41
+ )
You can’t perform that action at this time.
0 commit comments