diff --git a/src/openalea/deploy/multisetup.py b/src/openalea/deploy/multisetup.py index c7360e7..0ad3c9f 100644 --- a/src/openalea/deploy/multisetup.py +++ b/src/openalea/deploy/multisetup.py @@ -19,7 +19,9 @@ import re from subprocess import PIPE, Popen -from path import Path +# issue 49 : replace path by pathlib +# from path import Path +from pathlib import Path #from openalea.deploy.console import color_terminal, nocolor, bold, purple, red, green, underline @@ -71,7 +73,8 @@ def __init__(self, commands, packages=None, curdir='.', verbose=True): >>> Multisetup(["install","--keep-going"], ['deploy', 'visualea'], '.', verbose=True) """ #default - self.curdir = Path(curdir).abspath() + #self.curdir = Path(curdir).abspath() + self.curdir = Path(curdir).resolve() if isinstance(commands, list): self.commands = list(commands) elif isinstance(commands, str): @@ -247,27 +250,32 @@ def run(self, color=True): print('Will process the following directories: ',) for directory in directories: - print(bold(directory.basename()), end=' ') + print(bold(directory.name), end=' ') # pathlib + # print(bold(directory.basename()), end=' ') # path.py print('') try: for directory in directories: try: os.chdir(directory) - print(underline('Entering %s package' - % directory.basename())) + #print(underline('Entering %s package' + # % directory.basename())) + print(underline(f'Entering {directory.name} package')) + except OSError as e: - print(underline('Entering %s package' - % directory.basename()), end=' ') - print(red("cannot find this directory (%s)" - % directory.basename())) + #print(underline('Entering %s package' + # % directory.basename()), end=' ') + #print(red("cannot find this directory (%s)" + # % directory.basename())) + print(underline(f'Entering {directory.name} package'), end=' ') + print(red(f"cannot find this directory ({directory.name})")) print(e) print('Python exec : ', sys.executable) #print underline('Entering %s package' % directory.basename()) for cmd in self.commands: - setup_command = '%s setup.py %s ' % (sys.executable, cmd) + setup_command = f'{sys.executable} setup.py {cmd} ' # % (sys.executable, cmd) print("\tExecuting " + setup_command + '...processing', end=' ') #Run setup.py with user commands diff --git a/src/openalea/deploy/shared_data.py b/src/openalea/deploy/shared_data.py index cc9917a..2752f2f 100644 --- a/src/openalea/deploy/shared_data.py +++ b/src/openalea/deploy/shared_data.py @@ -21,6 +21,10 @@ import os from os.path import join as pj from os.path import realpath, isdir, isfile + +from pathlib import Path + +""" try: from path import Path except ImportError: @@ -31,6 +35,7 @@ from openalea.core.path import path as Path except ImportError: from IPython.external.path import path as Path +""" __license__ = "Cecill-C" __revision__ = " $Id: gforge.py 2243 2010-02-08 17:08:47Z cokelaer $ " @@ -86,22 +91,24 @@ def shared_data(package_path, filename=None, pattern=None, package_path = package_path[0] package_path = Path(package_path) ff = package_path / share_path - ff = ff.realpath() + # ff = ff.realpath() # path.py + ff = ff.resolve() shared_data_path = None - if ff.isdir(): + #if ff.isdir(): + if ff.is_dir(): if filename is None: shared_data_path = ff if pattern: - l = ff.glob(pattern) + l = list(ff.glob(pattern)) if l: shared_data_path = l else: ff = ff / filename - ff = ff.realpath() - if ff.isfile(): + ff = ff.resolve() + if ff.is_file(): shared_data_path = ff - if shared_data_path is None and (package_path / '__init__.py').isfile(): + if shared_data_path is None and (package_path / '__init__.py').is_file(): shared_data_path = shared_data(package_path.parent, filename, pattern, share_path) if shared_data_path is None: diff --git a/src/openalea/deploy/version.py b/src/openalea/deploy/version.py index 5d40bd3..190e5fc 100644 --- a/src/openalea/deploy/version.py +++ b/src/openalea/deploy/version.py @@ -4,10 +4,10 @@ major = 3 """(int) Version major component.""" -minor = 1 +minor = 2 """(int) Version minor component.""" -post = 2 +post = 0 """(int) Version post or bugfix component.""" __version__ = ".".join([str(s) for s in (major, minor, post)])