cubicweb/migration.py
changeset 12567 26744ad37953
parent 12536 c98e213f4eb2
child 12629 6b314fc558ed
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """utilities for instances migration"""
    18 """utilities for instances migration"""
    19 from __future__ import print_function
       
    20 
    19 
    21 import sys
    20 import sys
    22 import os
    21 import os
    23 import logging
    22 import logging
    24 import tempfile
    23 import tempfile
    25 from os.path import exists, join, basename, splitext
    24 from os.path import exists, join, basename, splitext
    26 from itertools import chain
    25 from itertools import chain
    27 
       
    28 from six import string_types
       
    29 
    26 
    30 from logilab.common import IGNORED_EXTENSIONS
    27 from logilab.common import IGNORED_EXTENSIONS
    31 from logilab.common.decorators import cached
    28 from logilab.common.decorators import cached
    32 from logilab.common.configuration import REQUIRED, read_old_config
    29 from logilab.common.configuration import REQUIRED, read_old_config
    33 from logilab.common.shellutils import ASK
    30 from logilab.common.shellutils import ASK
   403 
   400 
   404     def cmd_add_cubes(self, cubes):
   401     def cmd_add_cubes(self, cubes):
   405         """modify the list of used cubes in the in-memory config
   402         """modify the list of used cubes in the in-memory config
   406         returns newly inserted cubes, including dependencies
   403         returns newly inserted cubes, including dependencies
   407         """
   404         """
   408         if isinstance(cubes, string_types):
   405         if isinstance(cubes, str):
   409             cubes = (cubes,)
   406             cubes = (cubes,)
   410         origcubes = self.config.cubes()
   407         origcubes = self.config.cubes()
   411         newcubes = [p for p in self.config.expand_cubes(cubes)
   408         newcubes = [p for p in self.config.expand_cubes(cubes)
   412                     if not p in origcubes]
   409                     if not p in origcubes]
   413         if newcubes:
   410         if newcubes: