Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hdlmake
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Hdlmake
Commits
6800f5b3
Commit
6800f5b3
authored
14 years ago
by
Pawel Szostek
Browse files
Options
Downloads
Patches
Plain Diff
no "fetching" for local modules - everything stays at its place
parent
b88ba03a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
synthesis/depend.py
+12
-3
12 additions, 3 deletions
synthesis/depend.py
synthesis/fetch.py
+8
-3
8 additions, 3 deletions
synthesis/fetch.py
synthesis/hdlmake.py
+96
-102
96 additions, 102 deletions
synthesis/hdlmake.py
synthesis/path.py
+1
-1
1 addition, 1 deletion
synthesis/path.py
with
117 additions
and
109 deletions
synthesis/depend.py
+
12
−
3
View file @
6800f5b3
...
...
@@ -68,13 +68,12 @@ def generate_deps_for_modules(modules_paths):
opt_map_dict
[
module
]
=
parse_manifest
(
module_manifest_dict
[
module
])
module_files_dict
=
{}
from
hdlmake
import
make_list_of_files
from
path
import
make_list_of_files
for
module
in
modules_paths
:
if
module
in
opt_map_dict
:
module_files_dict
[
module
]
=
make_list_of_files
(
module
,
opt_map_dict
[
module
].
files
,
os
.
path
.
dirname
(
module_manifest_dict
[
module
]))
else
:
module_files_dict
[
module
]
=
make_list_of_files
(
module
)
all_files
=
[]
file_lib_dict
=
{}
...
...
@@ -85,10 +84,10 @@ def generate_deps_for_modules(modules_paths):
else
:
file_lib_dict
[
os
.
path
.
abspath
(
x
)]
=
"
work
"
all_files
.
append
(
os
.
path
.
abspath
(
x
))
all_files
=
list
(
set
(
all_files
))
#all_files = [(opt_map_dict[k].library, os.path.abspath(x)) for k in module_files_dict for x in module_files_dict[k]]
all_vhdl_files
=
[
x
for
x
in
all_files
if
os
.
path
.
splitext
(
x
)[
1
]
==
'
.vhd
'
]
p
.
vpprint
(
all_vhdl_files
)
file_use_clause_dict
=
{}
for
file
in
all_vhdl_files
:
...
...
@@ -135,6 +134,15 @@ def generate_deps_for_modules(modules_paths):
return
file_file_dict
,
file_lib_dict
def
generate_makefile
(
file_deps_dict
,
file_lib_dict
):
from
time
import
gmtime
,
strftime
import
path
date
=
strftime
(
"
%a, %d %b %Y %H:%M:%S
"
,
gmtime
())
notices
=
"""
#######################################################################
# This makefile has been automatically generated by hdl-make
# for testbench
"""
+
path
.
url_basename
(
global_mod
.
cwd
)
+
"""
on
"""
+
date
+
"""
#######################################################################
"""
make_preambule_p1
=
"""
## variables #############################
PWD := $(shell pwd)
WORK_NAME := work
...
...
@@ -166,6 +174,7 @@ clean:
pwd
=
os
.
getcwd
()
#open the file and write the above preambule (part 1)
f
=
open
(
"
makefile
"
,
"
w
"
)
f
.
write
(
notices
)
f
.
write
(
make_preambule_p1
)
libs
=
set
(
v
for
k
,
v
in
file_lib_dict
.
iteritems
())
...
...
This diff is collapsed.
Click to expand it.
synthesis/fetch.py
+
8
−
3
View file @
6800f5b3
...
...
@@ -23,15 +23,16 @@ def fetch_from_local(url):
quit
()
basename
=
path
.
url_basename
(
url
)
make_hdlm_dir
()
if
os
.
path
.
exists
(
global_mod
.
hdlm_path
+
"
/
"
+
basename
):
p
.
echo
(
"
Folder
"
+
global_mod
.
hdlm_path
+
"
/
"
+
basename
+
"
exists. Maybe it is already fetched?
"
)
return
os
.
symlink
(
url
,
global_mod
.
hdlm_path
+
"
/
"
+
basename
)
def
fetch_from_git
(
url
,
revision
=
None
):
cwd
=
os
.
getcwd
()
basename
=
url_basename
(
url
)
make_hdlm_dir
()
basename
=
url_basename
(
url
)
if
basename
.
endswith
(
"
.git
"
):
basename
=
basename
[:
-
4
]
#remove trailing .git
os
.
chdir
(
global_mod
.
hdlm_path
)
...
...
@@ -42,4 +43,8 @@ def fetch_from_git(url, revision = None):
os
.
chdir
(
basename
)
os
.
system
(
"
git checkout
"
+
revision
)
os
.
chdir
(
cwd
)
\ No newline at end of file
os
.
chdir
(
global_mod
.
cwd
)
def
make_hdlm_dir
():
if
not
os
.
path
.
exists
(
global_mod
.
hdlm_path
):
os
.
mkdir
(
global_mod
.
hdlm_path
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synthesis/hdlmake.py
+
96
−
102
View file @
6800f5b3
...
...
@@ -54,6 +54,15 @@ def check_module_and_append(list, module):
return
0
def
parse_manifest
(
manifest_file
):
def
make_list
(
sth
):
if
sth
!=
None
:
if
not
isinstance
(
sth
,
(
list
,
tuple
)):
sth
=
[
sth
]
else
:
sth
=
[]
return
sth
manifest_path
=
os
.
path
.
dirname
(
manifest_file
)
manifest_parser
=
cfgparse
.
ConfigParser
(
allow_py
=
True
)
...
...
@@ -70,39 +79,30 @@ def parse_manifest(manifest_file):
manifest_parser
.
add_file
(
manifest_file
)
#Take configuration parser from the global namespace
global_mod
.
opt_map
=
manifest_parser
.
parse
()
opt_map
=
manifest_parser
.
parse
()
if
global_mod
.
opt_map
.
root
==
None
:
global_mod
.
opt_map
.
root
=
"
.
"
if
opt_map
.
root
==
None
:
opt_map
.
root
=
"
.
"
if
global_mod
.
opt_map
.
rtl
==
None
:
global_mod
.
opt_map
.
rtl
=
[
"
.
"
]
elif
not
isinstance
(
global_mod
.
opt_map
.
rtl
,
list
):
global_mod
.
opt_map
.
rtl
=
[
global_mod
.
opt_map
.
rtl
]
if
opt_map
.
rtl
==
None
:
opt_map
.
rtl
=
[
"
.
"
]
elif
not
isinstance
(
opt_map
.
rtl
,
list
):
opt_map
.
rtl
=
[
opt_map
.
rtl
]
if
global_mod
.
opt_map
.
ise
==
None
:
global_mod
.
opt_map
.
ise
=
"
13.1
"
if
opt_map
.
ise
==
None
:
opt_map
.
ise
=
"
13.1
"
if
global_mod
.
opt_map
.
files
!=
None
:
if
not
isinstance
(
global_mod
.
opt_map
.
files
,
list
):
global_mod
.
opt_map
.
files
=
[
global_mod
.
opt_map
.
files
]
if
global_mod
.
opt_map
.
local
!=
None
:
if
not
isinstance
(
global_mod
.
opt_map
.
local
,
(
list
,
tuple
)):
global_mod
.
opt_map
.
local
=
[
global_mod
.
opt_map
.
local
]
for
i
in
global_mod
.
opt_map
.
local
:
if
path
.
is_abs_path
(
i
):
p
.
echo
(
sys
.
argv
[
0
]
+
"
accepts relative paths only:
"
+
i
)
quit
()
#global_mod.opt_map.local[:] = [x for x in global_mod.opt_map.local if not path.is_abs_path(
opt_map
.
local
=
make_list
(
opt_map
.
local
)
for
i
in
opt_map
.
local
:
if
path
.
is_abs_path
(
i
):
p
.
echo
(
sys
.
argv
[
0
]
+
"
accepts relative paths only:
"
+
i
)
quit
()
opt_map
.
local
=
[
path
.
rel2abs
(
x
,
manifest_path
)
for
x
in
opt_map
.
local
]
if
global_mod
.
opt_map
.
svn
!=
None
and
not
isinstance
(
global_mod
.
opt_map
.
svn
,
(
list
,
tuple
)):
global_mod
.
opt_map
.
svn
=
[
global_mod
.
opt_map
.
svn
]
if
global_mod
.
opt_map
.
git
!=
None
and
not
isinstance
(
global_mod
.
opt_map
.
git
,
(
list
,
tuple
)):
global_mod
.
opt_map
.
git
=
[
global_mod
.
opt_map
.
git
]
if
global_mod
.
opt_map
.
files
!=
None
and
not
isinstance
(
global_mod
.
opt_map
.
files
,
(
list
,
tuple
)):
global_mod
.
opt_map
.
files
=
[
global_mod
.
opt_map
.
files
]
return
global_mod
.
opt_map
opt_map
.
svn
=
make_list
(
opt_map
.
svn
)
opt_map
.
git
=
make_list
(
opt_map
.
git
)
opt_map
.
files
=
make_list
(
opt_map
.
files
)
return
opt_map
def
convert_xise
(
xise
):
...
...
@@ -228,92 +228,72 @@ def main():
tcl_pat
=
re
.
compile
(
"
^.*\.tcl$
"
)
for
file
in
os
.
listdir
(
"
.
"
):
#try to find it in the current dir
if
re
.
match
(
tcl_pat
,
file
):
p
.
vprint
(
"
Found .tcl file in the current directory:
"
+
file
)
p
.
vprint
(
"
Found .tc
f
l file in the current directory:
"
+
file
)
global_mod
.
opt_map
.
tcl
=
file
break
else
:
global_mod
.
opt_map
.
tcl
=
options
.
tcl
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
fetch
==
True
:
if
not
os
.
path
.
exists
(
global_mod
.
hdlm_path
):
os
.
mkdir
(
global_mod
.
hdlm_path
)
cur_manifest
=
global_mod
.
top_manifest
involved_modules
=
[]
new_manifests
=
[]
while
True
:
if
global_mod
.
opt_map
.
local
!=
None
:
for
i
in
global_mod
.
opt_map
.
local
:
if
not
os
.
path
.
exists
(
global_mod
.
cwd
+
'
/
'
+
i
):
p
.
echo
(
"
Error in parsing
"
+
cur_manifest
+
"
. There is not such catalogue as
"
+
global_mod
.
cwd
+
'
/
'
+
i
)
for
i
in
global_mod
.
opt_map
.
local
:
if
not
os
.
path
.
exists
(
i
):
p
.
echo
(
"
Error in parsing
"
+
cur_manifest
+
"
. There is not such catalogue as
"
+
global_mod
.
cwd
+
'
/
'
+
i
)
p
.
vprint
(
"
Modules waiting in fetch queue:
"
+
str
(
global_mod
.
opt_map
.
git
)
+
"
"
+
str
(
global_mod
.
opt_map
.
svn
)
+
"
"
+
str
(
global_mod
.
opt_map
.
local
))
if
global_mod
.
opt_map
.
svn
!=
None
:
for
i
in
global_mod
.
opt_map
.
svn
:
p
.
vprint
(
"
Checking SVN url:
"
+
i
)
try
:
url
,
revision
=
parse_repo_url
(
i
)
fetch_from_svn
(
url
,
revision
)
except
ValueError
:
url
=
parse_repo_url
(
i
)
fetch_from_svn
(
url
)
except
RuntimeError
:
continue
ret
=
check_module_and_append
(
involved_modules
,
os
.
path
.
abspath
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
)))
if
ret
==
0
:
manifest
=
search_for_manifest
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
))
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
global_mod
.
opt_map
.
svn
=
None
for
i
in
global_mod
.
opt_map
.
svn
:
p
.
vprint
(
"
Checking SVN url:
"
+
i
)
try
:
url
,
revision
=
parse_repo_url
(
i
)
fetch_from_svn
(
url
,
revision
)
except
ValueError
:
url
=
parse_repo_url
(
i
)
fetch_from_svn
(
url
)
except
RuntimeError
:
continue
ret
=
check_module_and_append
(
involved_modules
,
os
.
path
.
abspath
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
)))
if
ret
==
0
:
manifest
=
search_for_manifest
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
))
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
global_mod
.
opt_map
.
svn
=
None
if
global_mod
.
opt_map
.
git
!=
None
:
for
i
in
global_mod
.
opt_map
.
git
:
p
.
vprint
(
"
Checking git url:
"
+
i
)
try
:
url
,
revision
=
parse_repo_url
(
i
)
fetch_from_git
(
url
,
revision
)
except
ValueError
:
url
=
parse_repo_url
(
i
)
fetch_from_git
(
url
)
except
RuntimeError
:
continue
if
url
.
endswith
(
"
.git
"
):
url
=
url
[:
-
4
]
ret
=
check_module_and_append
(
involved_modules
,
os
.
path
.
abspath
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
)))
if
ret
==
0
:
manifest
=
search_for_manifest
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
))
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
global_mod
.
opt_map
.
git
=
None
for
i
in
global_mod
.
opt_map
.
git
:
p
.
vprint
(
"
Checking git url:
"
+
i
)
try
:
url
,
revision
=
parse_repo_url
(
i
)
fetch_from_git
(
url
,
revision
)
except
ValueError
:
url
=
parse_repo_url
(
i
)
fetch_from_git
(
url
)
except
RuntimeError
:
continue
if
url
.
endswith
(
"
.git
"
):
url
=
url
[:
-
4
]
ret
=
check_module_and_append
(
involved_modules
,
os
.
path
.
abspath
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
)))
if
ret
==
0
:
manifest
=
search_for_manifest
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
))
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
global_mod
.
opt_map
.
git
=
None
if
global_mod
.
opt_map
.
local
!=
None
:
for
i
in
global_mod
.
opt_map
.
local
:
i
=
os
.
path
.
abspath
(
path
.
rel2abs
(
os
.
path
.
expanduser
(
i
),
os
.
path
.
dirname
(
cur_manifest
)))
p
.
vprint
(
"
Checking local url:
"
+
i
)
try
:
url
,
revision
=
i
print
"
Revision number not allowed in local URLs
"
continue
except
ValueError
:
url
=
i
if
not
os
.
path
.
exists
(
url
):
print
"
Specified module (
"
+
url
+
"
) does not exist
"
print
"
Ommitting
"
continue
fetch_from_local
(
url
)
ret
=
check_module_and_append
(
involved_modules
,
os
.
path
.
abspath
(
global_mod
.
hdlm_path
+
"
/
"
+
path
.
url_basename
(
url
)))
if
ret
==
0
:
manifest
=
search_for_manifest
(
url
)
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
global_mod
.
opt_map
.
local
=
None
for
i
in
global_mod
.
opt_map
.
local
:
manifest
=
search_for_manifest
(
i
)
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
involved_modules
.
extend
(
global_mod
.
opt_map
.
local
)
if
len
(
new_manifests
)
==
0
:
p
.
vprint
(
"
All found manifests have been scanned
"
)
break
...
...
@@ -400,15 +380,30 @@ def main():
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
make
==
True
:
import
depend
if
not
os
.
path
.
exists
(
global_mod
.
hdlm_path
):
p
.
echo
(
"
There is no
"
+
global_mod
.
hdlm_path
+
"
catalog. Probably modules are not fetched?
"
)
quit
()
cur_manifest
=
global_mod
.
top_manifest
involved_modules
=
[]
new_manifests
=
[]
opt_map
=
global_mod
.
opt_map
while
True
:
if
opt_map
.
local
!=
None
:
involved_modules
.
extend
(
opt_map
.
local
)
for
i
in
opt_map
.
local
:
manifest
=
search_for_manifest
(
i
)
if
manifest
!=
None
:
new_manifests
.
append
(
manifest
)
if
len
(
new_manifests
)
==
0
:
break
;
cur_manifest
=
new_manifests
.
pop
()
opt_map
=
parse_manifest
(
cur_manifest
)
modules
=
os
.
listdir
(
global_mod
.
hdlm_path
)
modules
=
involved_modules
if
os
.
path
.
exists
(
global_mod
.
hdlm_path
):
modules
+=
[
global_mod
.
hdlm_path
+
"
/
"
+
x
for
x
in
os
.
listdir
(
global_mod
.
hdlm_path
)]
if
len
(
modules
)
==
0
:
p
.
vprint
(
"
No modules were found in
"
+
global_mod
.
hdlm_path
)
modules
=
[
global_mod
.
hdlm_path
+
"
/
"
+
x
for
x
in
modules
]
#modules += global_mod.opt_map.rtl
p
.
vprint
(
"
Modules that will be taken into account in the makefile:
"
+
str
(
modules
))
deps
,
libs
=
depend
.
generate_deps_for_modules
(
modules
)
...
...
@@ -426,7 +421,6 @@ def main():
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
__name__
==
"
__main__
"
:
#global options' map for use in the entire script
t0
=
None
...
...
This diff is collapsed.
Click to expand it.
synthesis/path.py
+
1
−
1
View file @
6800f5b3
...
...
@@ -82,7 +82,7 @@ def make_list_of_files(modules, take_files = None, base_folder = None):
for
module
in
modules
:
files
.
extend
(
getfiles
(
module
))
if
take_files
!=
None
:
if
take_files
!=
None
and
take_files
!=
[]
:
ret_files
=
[]
for
file
in
files
:
for
take_file
in
take_files
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment