Skip to content

Commit

Permalink
Merge pull request #42 from openalea/py3
Browse files Browse the repository at this point in the history
Python 3
  • Loading branch information
pradal authored Dec 19, 2019
2 parents d5701f6 + e74ab1f commit 4144f5e
Show file tree
Hide file tree
Showing 32 changed files with 500 additions and 416 deletions.
2 changes: 1 addition & 1 deletion .pkglts/pkg_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
"version": {
"major": 2,
"minor": 1,
"post": 7
"post": 8
}
}
8 changes: 4 additions & 4 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "2.1.7" %}
{% set version = "2.1.8" %}

package:
name: openalea.deploy
Expand All @@ -17,13 +17,13 @@ requirements:
- python {{PY_VER}}* [not win]
- python {{PY_VER}} [win]
- setuptools
- pywin32 # [win]
- pywin32 [win]
- six
run:
- python {{PY_VER}}* [not win]
- python {{PY_VER}} [win]
- setuptools
- pywin32 # [win]
- pywin32 [win]
- six
- path.py

Expand All @@ -34,4 +34,4 @@ test:
about:
home: http://github.com/openalea/deploy
license: Cecill-C License
summary: OpenAlea.Deploy support the installation of OpenAlea packages via the network and manage their dependencies.
summary: OpenAlea.Deploy support the installation of OpenAlea packages via the network and manage their dependencies.
1 change: 1 addition & 0 deletions src/openalea/deploy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
# {# pkglts, base

from . import version
Expand Down
2 changes: 2 additions & 0 deletions src/openalea/deploy/alea_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
The global shared dir can be set by this command.
"""

from __future__ import absolute_import
from __future__ import print_function
__license__ = "Cecill-C"
__revision__ = " $Id$"

Expand Down
1 change: 1 addition & 0 deletions src/openalea/deploy/alea_install.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Script to wrap easy install with some post-processing"""

from __future__ import absolute_import
__license__ = "Cecill-C"
__revision__ = " $Id$"

Expand Down
19 changes: 11 additions & 8 deletions src/openalea/deploy/alea_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
#
# OpenAlea.Deploy: OpenAlea setuptools extension
#
# Copyright 2006-2009 INRIA - CIRAD - INRA
# Copyright 2006-2009 INRIA - CIRAD - INRA
#
# File author(s): Samuel Dufour-Kowalski <samuel.dufour@sophia.inria.fr>
#
# Distributed under the Cecill-C License.
# See accompanying file LICENSE.txt or copy at
# http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html
#
#
# OpenAlea WebSite : http://openalea.gforge.inria.fr
#
"""todo"""

from __future__ import absolute_import
from __future__ import print_function

__license__ = "Cecill-C"
__revision__ = " $Id$"

Expand All @@ -32,12 +35,12 @@ def remove_egg(project_name, dist):
location = dist.location

try:
print ("Remove ", project_name, version, location)
print("Remove ", project_name, version, location)
if (os.path.isdir(location)):
print ("Remove directory : %s" % (location,))
print("Remove directory : %s" % (location,))
shutil.rmtree(location)
else:
print ("Remove file %s" % (location))
print("Remove file %s" % (location))
os.remove(location)
return True

Expand All @@ -46,8 +49,8 @@ def remove_egg(project_name, dist):
return False

except:
print ("Unexpected error:", sys.exc_info()[0])
print ("Please check you have permission to remove packages. ")
print("Unexpected error:", sys.exc_info()[0])
print("Please check you have permission to remove packages. ")
return False


Expand All @@ -73,7 +76,7 @@ def update_all():
env = Environment()

for project_name in env._distmap.keys():
print ("Update %s" % (project_name))
print("Update %s" % (project_name))
alea_install_U(project_name)


Expand Down
2 changes: 2 additions & 0 deletions src/openalea/deploy/autosum_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Small functions to manipulate autosum files
"""

from __future__ import absolute_import
from __future__ import print_function
from os.path import join, dirname, basename, splitext
from .list_modules import list_modules

Expand Down
20 changes: 11 additions & 9 deletions src/openalea/deploy/binary_deps.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
"""binary dependencies"""
"""Binary dependencies."""

__license__ = "Cecill-C"
__revision__ = " $Id$"
from __future__ import absolute_import
from __future__ import print_function

import pkg_resources
import warnings

__license__ = "Cecill-C"
__revision__ = " $Id$"


def binary_deps(pkg, verbose=True):
""" add to the pkg the version number for binary dependency
""" add to the pkg the version number for binary dependency
:param pkg: package
:param verbose: default is True
"""

try:
dists = pkg_resources.require(pkg)
except:
warnings.warn("package '" + pkg + "' not found.")
return pkg

deps = pkg + '==' + dists[0].version

if verbose:
print ("Binary dependency : '" + deps + "'")
print("Binary dependency : '" + deps + "'")
return deps
22 changes: 17 additions & 5 deletions src/openalea/deploy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from __future__ import print_function


from __future__ import absolute_import
from six.moves import input
__license__ = "Cecill-C"
__revision__ = " $Id$ "

Expand Down Expand Up @@ -52,12 +54,15 @@
# from distutils.util import convert_path
from distutils.dir_util import mkpath
import re
PY3K = False
try:
# Python 3
import configparser
PY3K = True
except:
# Python 2
import ConfigParser as configparser
import six.moves.configparser as configparser
PY3K = False

from .util import get_all_lib_dirs, get_all_bin_dirs, DEV_DIST
from .install_lib import get_dyn_lib_dir
Expand Down Expand Up @@ -115,7 +120,14 @@ def has_ext_modules(dist):
def set_has_ext_modules(dist):
""" Set new function handler to dist object """
from types import MethodType as instancemethod
m = instancemethod(has_ext_modules, dist, Distribution)

try:
# Python 2
m = instancemethod(has_ext_modules, dist, Distribution)
except TypeError:
# Python 3
m = instancemethod(has_ext_modules, dist)

dist.has_ext_modules = m


Expand Down Expand Up @@ -461,7 +473,7 @@ def run(self):
param, externp])
commandstr = command + ' ' + command_param

# Run scons install
# Run scons install
# To correctly dispatch the dll in the conda prefix bin dir
if self.scons_install:

Expand Down Expand Up @@ -732,7 +744,7 @@ def finalize_options(self):
repolist = get_repo_list()
if (not self.find_links):
self.find_links = ""
self.find_links += " " + " ".join(repolist)
self.find_links += str(b" " + b" ".join(repolist))

self.dist = None

Expand Down Expand Up @@ -1271,7 +1283,7 @@ def finalize_options(self):
self.release = version

if not self.username:
self.username = input('login:')
self.username = eval(input('login:'))
# to be used with gforge tools only. not with scp tht is currently used.
# if not self.password:
# self.password = raw_input('password:')
Expand Down
1 change: 1 addition & 0 deletions src/openalea/deploy/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:license: BSD, see LICENSE for details.
"""

from __future__ import absolute_import
import os
import sys

Expand Down
1 change: 1 addition & 0 deletions src/openalea/deploy/doc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""Functions used to automatize documentation of code
"""

from __future__ import absolute_import
__license__ = "Cecill-C"
__revision__ = " $Id:$"

Expand Down
Loading

0 comments on commit 4144f5e

Please sign in to comment.