File tree Expand file tree Collapse file tree 3 files changed +19
-22
lines changed Expand file tree Collapse file tree 3 files changed +19
-22
lines changed Original file line number Diff line number Diff line change 1- import labscript_profile; labscript_profile.add_userlib_and_pythonlib()
2- import labscript_profile; labscript_profile.add_development_directories()
1+ import sys; exec("try: import labscript_profile; labscript_profile.add_userlib_and_pythonlib()\nexcept ModuleNotFoundError: pass")
Original file line number Diff line number Diff line change 1+ import site
12import sys
23import os
34from configparser import ConfigParser , NoSectionError , NoOptionError
@@ -56,22 +57,4 @@ def add_userlib_and_pythonlib():
5657 except (NoSectionError , NoOptionError ):
5758 paths = []
5859 for path in paths :
59- if os .path .exists (path ):
60- sys .path .append (path )
61-
62-
63- def add_development_directories ():
64- """Prepend directories in <LABSCRIPT_SUITE_PROFILE>/dev to the search path, if they
65- are listed in the file <LABSCRIPT_SUITE_PROFILE>/dev/enabled (if that file
66- exists)."""
67- if LABSCRIPT_SUITE_PROFILE is None :
68- return
69- dev_dir = LABSCRIPT_SUITE_PROFILE / 'dev'
70- enabled_file = dev_dir / 'enabled'
71- if not os .path .exists (enabled_file ):
72- return
73- with open (enabled_file ) as f :
74- for line in f :
75- repository = dev_dir / line .strip ()
76- if os .path .isdir (repository ):
77- sys .path .insert (0 , repository )
60+ site .addsitedir (path )
Original file line number Diff line number Diff line change 11import os
22from setuptools import setup
3+ from setuptools .command .develop import develop
4+ from distutils import log
5+
6+
7+ class develop_command (develop ):
8+ """Custom develop command which installs the .pth file to site-packages for editable
9+ installs."""
10+ def run (self ):
11+ path = os .path .join (self .install_dir , 'labscript-suite.pth' )
12+ super ().run ()
13+ if not self .uninstall :
14+ log .info (f'Copying labscript-suite.pth to { path } ' )
15+ if not self .dry_run :
16+ self .copy_file ('labscript-suite.pth' , path )
17+
318
419VERSION_SCHEME = {
520 "version_scheme" : os .getenv ("SCM_VERSION_SCHEME" , "guess-next-dev" ),
621 "local_scheme" : os .getenv ("SCM_LOCAL_SCHEME" , "node-and-date" ),
722}
823
9- setup (use_scm_version = VERSION_SCHEME )
24+ setup (use_scm_version = VERSION_SCHEME , cmdclass = { 'develop' : develop_command } )
You can’t perform that action at this time.
0 commit comments