consolidate clean and fetch actions into a single class

parent 53a7393d
......@@ -22,7 +22,6 @@
from .check_condition import CheckCondition
from .check_manifest import CheckManifest
from .clean import CleanModules
from .fetch import FetchModules
from .list_files import ListFiles
from .list_modules import ListModules
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Hdlmake is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import logging
import hdlmake.fetch as fetch
from .action import Action
class CleanModules(Action):
def clean(self):
logging.info("Removing fetched modules..")
remove_list = [m for m in self if m.source in [fetch.GIT, fetch.SVN] and m.isfetched]
remove_list.reverse() # we will remove modules in backward order
if len(remove_list):
for m in remove_list:
logging.info("... clean: " + m.url + " [from: " + m.path + "]")
m.remove_dir_from_disk()
else:
logging.info("There are no modules to be removed")
logging.info("Modules cleaned.")
......@@ -24,6 +24,7 @@ import sys
import os
from .action import Action
import hdlmake.fetch as fetch
class FetchModules(Action):
......@@ -35,3 +36,17 @@ class FetchModules(Action):
self.fetch_all()
os.system(top_module.manifest_dict["fetch_post_cmd"])
logging.info("All modules fetched.")
def clean(self):
logging.info("Removing fetched modules..")
remove_list = [m for m in self if m.source in [fetch.GIT, fetch.SVN] and m.isfetched]
remove_list.reverse() # we will remove modules in backward order
if len(remove_list):
for m in remove_list:
logging.info("... clean: " + m.url + " [from: " + m.path + "]")
m.remove_dir_from_disk()
else:
logging.info("There are no modules to be removed")
logging.info("Modules cleaned.")
......@@ -34,13 +34,13 @@ from . import new_dep_solver as dep_solver
from .util import path as path_mod
from . import fetch
from .env import Env
from .action import (CheckManifest, CheckCondition, CleanModules, FetchModules, ListFiles,
from .action import (CheckManifest, CheckCondition, FetchModules, ListFiles,
ListModules, MergeCores, Tree, GenerateSimulationMakefile,
GenerateSynthesisMakefile, GenerateRemoteSynthesisMakefile, GenerateSynthesisProject,
QsysHwTclUpdate)
class ModulePool(list, CheckManifest, CheckCondition, CleanModules, FetchModules, ListFiles,
class ModulePool(list, CheckManifest, CheckCondition, FetchModules, ListFiles,
ListModules, MergeCores, Tree, GenerateSimulationMakefile,
GenerateSynthesisMakefile, GenerateRemoteSynthesisMakefile, GenerateSynthesisProject,
QsysHwTclUpdate):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment