コード例 #1
0
ファイル: project.py プロジェクト: scarabeusiv/osc2
    def repair(path, project='', apiurl='', no_packages=False,
               **package_states):
        """Repair a working copy.

        path is the path to the project working copy.

        Keyword arguments:
        project -- the name of the project (default: '')
        apiurl -- the apiurl of the project (default: '')
        no_packages -- do not repair the project's packages (default: False)
        **package_states -- a package to state mapping (default: {})

        """
        global _PKG_DATA
        missing, xml_data, pkg_data = Project.wc_check(path)
        if '_project' in missing:
            if not project:
                raise ValueError('project argument required')
            wc_write_project(path, project)
        if '_apiurl' in missing:
            if not apiurl:
                raise ValueError('apiurl argument required')
            wc_write_apiurl(path, apiurl)
        if '_packages' in missing or xml_data:
            if not package_states:
                raise ValueError('package states required')
            wc_write_packages(path, '<packages/>')
            packages = wc_read_packages(path)
            for package, st in package_states.items():
                packages.add(package, state=st)
            packages.write()
        if '_version' in missing:
            wc_write_version(path)
        if _PKG_DATA in missing:
            os.mkdir(wc_pkg_data_filename(path, ''))
        if not no_packages:
            project = wc_read_project(path)
            apiurl = wc_read_apiurl(path)
            packages = wc_read_packages(path)
            missing, xml_data, pkg_data = Project.wc_check(path)
            # only pkg data left
            for package in pkg_data:
                package_path = os.path.join(path, package)
                if os.path.isdir(package_path):
                    storedir = wc_pkg_data_mkdir(path, package)
                    Package.repair(package_path, project=project,
                                   package=package, apiurl=apiurl,
                                   ext_storedir=storedir)
                else:
                    packages.remove(package)
                    packages.write()
コード例 #2
0
ファイル: project.py プロジェクト: vikas-lamba/osc2
    def repair(path, project='', apiurl='', no_packages=False,
               **package_states):
        """Repair a working copy.

        path is the path to the project working copy.

        Keyword arguments:
        project -- the name of the project (default: '')
        apiurl -- the apiurl of the project (default: '')
        no_packages -- do not repair the project's packages (default: False)
        **package_states -- a package to state mapping (default: {})

        """
        global _PKG_DATA
        missing, xml_data, pkg_data = Project.wc_check(path)
        if '_project' in missing:
            if not project:
                raise ValueError('project argument required')
            wc_write_project(path, project)
        if '_apiurl' in missing:
            if not apiurl:
                raise ValueError('apiurl argument required')
            wc_write_apiurl(path, apiurl)
        if '_packages' in missing or xml_data:
            if not package_states:
                raise ValueError('package states required')
            wc_write_packages(path, '<packages/>')
            packages = wc_read_packages(path)
            for package, st in package_states.iteritems():
                packages.add(package, state=st)
            packages.write()
        if '_version' in missing:
            wc_write_version(path)
        if _PKG_DATA in missing:
            os.mkdir(wc_pkg_data_filename(path, ''))
        if not no_packages:
            project = wc_read_project(path)
            apiurl = wc_read_apiurl(path)
            packages = wc_read_packages(path)
            missing, xml_data, pkg_data = Project.wc_check(path)
            # only pkg data left
            for package in pkg_data:
                package_path = os.path.join(path, package)
                if os.path.isdir(package_path):
                    storedir = wc_pkg_data_mkdir(path, package)
                    Package.repair(package_path, project=project,
                                   package=package, apiurl=apiurl,
                                   ext_storedir=storedir)
                else:
                    packages.remove(package)
                    packages.write()
コード例 #3
0
ファイル: project.py プロジェクト: scarabeusiv/osc2
    def init(path, project, apiurl, *args, **kwargs):
        """Initializes a directory as a project working copy.

        path is a path to a directory, project is the name
        of the project and apiurl is the apiurl.
        *args and **kwargs are additional arguments for the
        Project's __init__ method.

        """
        wc_init(path)
        wc_write_project(path, project)
        wc_write_apiurl(path, apiurl)
        wc_write_packages(path, '<packages/>')
        return Project(path, *args, **kwargs)
コード例 #4
0
ファイル: project.py プロジェクト: vikas-lamba/osc2
    def init(path, project, apiurl, *args, **kwargs):
        """Initializes a directory as a project working copy.

        path is a path to a directory, project is the name
        of the project and apiurl is the apiurl.
        *args and **kwargs are additional arguments for the
        Project's __init__ method.

        """
        wc_init(path)
        wc_write_project(path, project)
        wc_write_apiurl(path, apiurl)
        wc_write_packages(path, '<packages/>')
        return Project(path, *args, **kwargs)
コード例 #5
0
    def init(path, project, package, apiurl, ext_storedir=None, **kwargs):
        """Initializes a directory as a package working copy.

        path is a path to a directory, project is the name
        of the project, package is the name of the package
        and apiurl is the apiurl.

        Keyword arguments:
        ext_storedir -- path to the storedir (default: None).
                        If not specified a "flat" package is created,
                        otherwise path/.osc is a symlink to storedir.
        kwargs -- optional keyword args which are passed to Package's
                  __init__ method

        """
        wc_init(path, ext_storedir=ext_storedir)
        wc_write_project(path, project)
        wc_write_package(path, package)
        wc_write_apiurl(path, apiurl)
        wc_write_files(path, '<directory/>')
        return Package(path, **kwargs)
コード例 #6
0
ファイル: package.py プロジェクト: scarabeusiv/osc2
    def init(path, project, package, apiurl, ext_storedir=None, **kwargs):
        """Initializes a directory as a package working copy.

        path is a path to a directory, project is the name
        of the project, package is the name of the package
        and apiurl is the apiurl.

        Keyword arguments:
        ext_storedir -- path to the storedir (default: None).
                        If not specified a "flat" package is created,
                        otherwise path/.osc is a symlink to storedir.
        kwargs -- optional keyword args which are passed to Package's
                  __init__ method

        """
        wc_init(path, ext_storedir=ext_storedir)
        wc_write_project(path, project)
        wc_write_package(path, package)
        wc_write_apiurl(path, apiurl)
        wc_write_files(path, '<directory/>')
        return Package(path, **kwargs)