Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
3b10299a
Commit
3b10299a
authored
Oct 13, 2015
by
Nicolas Chevillot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat-1176) Only one call to os.getcwd(), stored in global module.
parent
9d303eea
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
21 deletions
+24
-21
__main__.py
hdlmake/__main__.py
+5
-3
merge_cores.py
hdlmake/action/merge_cores.py
+2
-2
remote_synthesis.py
hdlmake/action/remote_synthesis.py
+1
-3
dep_file.py
hdlmake/dep_file.py
+1
-1
dep_solver.py
hdlmake/dep_solver.py
+1
-1
git.py
hdlmake/fetch/git.py
+6
-5
svn.py
hdlmake/fetch/svn.py
+3
-2
global_mod.py
hdlmake/global_mod.py
+1
-1
module_pool.py
hdlmake/module_pool.py
+1
-1
path.py
hdlmake/util/path.py
+3
-2
No files found.
hdlmake/__main__.py
View file @
3b10299a
...
...
@@ -46,13 +46,15 @@ from action import (CheckCondition, CleanModules, FetchModules, GenerateFetchMak
def
main
():
"""This is the main funcion, where HDLMake starts.
"""This is the main func
t
ion, 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
...
...
@@ -80,7 +82,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
)
...
...
hdlmake/action/merge_cores.py
View file @
3b10299a
...
...
@@ -28,7 +28,7 @@ import os
import
os.path
import
time
import
sys
import
global_mod
class
MergeCores
(
Action
):
def
_check_manifest
(
self
):
...
...
@@ -100,6 +100,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
hdlmake/action/remote_synthesis.py
View file @
3b10299a
...
...
@@ -27,8 +27,6 @@ import sys
import
global_mod
from
srcfile
import
SourceFileFactory
import
importlib
class
GenerateRemoteSynthesisMakefile
(
Action
):
...
...
@@ -91,7 +89,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."
)
...
...
hdlmake/dep_file.py
View file @
3b10299a
...
...
@@ -98,7 +98,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
):
...
...
hdlmake/dep_solver.py
View file @
3b10299a
...
...
@@ -107,7 +107,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
...
...
hdlmake/fetch/git.py
View file @
3b10299a
...
...
@@ -26,13 +26,14 @@ from tempfile import TemporaryFile
from
subprocess
import
Popen
,
PIPE
import
fetch
from
fetcher
import
Fetcher
import
global_mod
class
GitSubmodule
(
Fetcher
):
def
fetch
(
self
,
module
):
if
module
.
source
!=
fetch
.
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
:
...
...
hdlmake/fetch/svn.py
View file @
3b10299a
...
...
@@ -25,6 +25,7 @@ from tempfile import TemporaryFile
from
util
import
path
from
subprocess
import
Popen
,
PIPE
from
fetcher
import
Fetcher
import
global_mod
class
Svn
(
Fetcher
):
...
...
@@ -35,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
)
...
...
@@ -61,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
()
...
...
hdlmake/global_mod.py
View file @
3b10299a
...
...
@@ -29,4 +29,4 @@ mod_pool = None
sim_tool
=
None
env
=
None
tool_module
=
None
current_path
=
None
hdlmake/module_pool.py
View file @
3b10299a
...
...
@@ -113,7 +113,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
)
...
...
hdlmake/util/path.py
View file @
3b10299a
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment