Commit adae15e7 authored by Javier D. Garcia Lasheras's avatar Javier D. Garcia Lasheras

Fix conflicts after merging feat_1176 branch into develop

parents 90ef9029 3b10299a
......@@ -48,13 +48,15 @@ from ._version import __version__
def main():
"""This is the main funcion, where HDLMake starts.
"""This is the main function, where HDLMake starts.
Here, we make the next processes:
-- parse command
-- check and set the environment
-- prepare the global module containing the heavy common stuff
"""
"""
# Remember current path
global_mod.current_path = os.getcwd()
#
# SET & GET PARSER
......@@ -82,7 +84,7 @@ def main():
modules_pool = ModulePool()
modules_pool.new_module(parent=None,
url=os.getcwd(),
url=global_mod.current_path,
source=fetch_mod.LOCAL,
fetchto=".",
process_manifest=False)
......
......@@ -31,6 +31,8 @@ from hdlmake.vlog_parser import VerilogPreprocessor
from .action import Action
import global_mod
class MergeCores(Action):
def _check_manifest(self):
......@@ -102,6 +104,6 @@ class MergeCores(Action):
for ngc in flist.filter(NGCFile):
import shutil
logging.info("copying NGC file: %s" % ngc.rel_path())
shutil.copy(ngc.rel_path(), os.getcwd())
shutil.copy(ngc.rel_path(), global_mod.current_path)
logging.info("Cores merged.")
\ No newline at end of file
logging.info("Cores merged.")
......@@ -91,7 +91,7 @@ class GenerateRemoteSynthesisMakefile(Action):
files.add(sff.new(top_mod.syn_project, module=None))
tool_object.generate_remote_synthesis_makefile(files=files, name=top_mod.syn_name,
cwd=os.getcwd(), user=self.env["rsynth_user"],
cwd=global_mod.current_path, user=self.env["rsynth_user"],
server=self.env["rsynth_server"])
logging.info("Remote synthesis makefile generated.")
......
......@@ -99,7 +99,7 @@ class File(object):
def rel_path(self, dir=None):
if dir is None:
dir = os.getcwd()
dir = global_mod.current_path
return path_mod.relpath(self.path, dir)
def __str__(self):
......
......@@ -108,7 +108,7 @@ class VerilogDependencySolver(DependencySolver):
inc_dirs = self._parse_vlog_opt(v_file.vlog_opt)
for dir in inc_dirs:
dir = os.path.join(os.getcwd(), dir)
dir = os.path.join(global_mod.current_path, dir)
if not os.path.exists(dir) or not os.path.isdir(dir):
logging.warning("Include path "+dir+" doesn't exist")
continue
......
......@@ -26,13 +26,14 @@ from tempfile import TemporaryFile
from subprocess import Popen, PIPE
from .constants import (GIT, GITSUBMODULE)
from .fetcher import Fetcher
import global_mod
class GitSubmodule(Fetcher):
def fetch(self, module):
if module.source != GITSUBMODULE:
raise ValueError("This backend should get git modules only.")
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
os.chdir(module.fetchto)
os.system("git submodule init")
os.system("git submodule update")
......@@ -45,7 +46,7 @@ class Git(Fetcher):
@staticmethod
def get_git_toplevel(module):
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
try:
os.chdir(path.rel2abs(module.path))
if not os.path.exists(".gitmodules"):
......@@ -63,7 +64,7 @@ class Git(Fetcher):
def get_git_submodules(module):
submodule_dir = path.rel2abs(module.path)
logging.debug("Checking git submodules in %s" % submodule_dir)
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
try:
os.chdir(submodule_dir)
......@@ -117,7 +118,7 @@ submodule.ip_cores/wr-cores.url=git://ohwr.org/hdl-core-lib/wr-cores.git
if not os.path.exists(module.fetchto):
os.mkdir(module.fetchto)
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
if module.branch is None:
module.branch = "master"
......@@ -164,7 +165,7 @@ submodule.ip_cores/wr-cores.url=git://ohwr.org/hdl-core-lib/wr-cores.git
@staticmethod
def check_commit_id(path):
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
commit = None
stderr = TemporaryFile()
try:
......
......@@ -23,10 +23,9 @@ import os
import logging
from tempfile import TemporaryFile
from subprocess import Popen, PIPE
from hdlmake.util import path
from .fetcher import Fetcher
import global_mod
class Svn(Fetcher):
......@@ -37,7 +36,7 @@ class Svn(Fetcher):
if not os.path.exists(module.fetchto):
os.mkdir(module.fetchto)
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
os.chdir(module.fetchto)
basename = path.url_basename(module.url)
......@@ -63,7 +62,7 @@ class Svn(Fetcher):
@staticmethod
def check_revision_number(path):
cur_dir = os.getcwd()
cur_dir = global_mod.current_path
revision = None
stderr = TemporaryFile()
......
......@@ -30,3 +30,4 @@ sim_tool = None
env = None
tool_module = None
makefile_writer = None
current_path = None
......@@ -114,7 +114,7 @@ class ModulePool(list):
def _guess_origin(self, path):
"""Guess origin (git, svn, local) of a module at given path"""
cwd = os.getcwd()
cwd = global_mod.current_path
try:
os.chdir(path)
git_out = Popen("git config --get remote.origin.url", stdout=PIPE, shell=True, close_fds=True)
......
......@@ -23,6 +23,7 @@
from __future__ import print_function
import os
import logging
import global_mod
def url_parse(url):
......@@ -114,7 +115,7 @@ def is_abs_path(path):
def relpath(p1, p2=None):
if p2 is None:
p2 = os.getcwd()
p2 = global_mod.current_path
if p1 == p2:
return '.'
p1, p2 = p2, p1
......@@ -142,7 +143,7 @@ def rel2abs(path, base=None):
@return the relative path of path from base
"""
if base is None:
base = os.getcwd()
base = global_mod.current_path
if os.path.isabs(path):
return path
retval = os.path.join(base, path)
......
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