Commit 089b2af4 authored by Josh Smith's avatar Josh Smith

Refactored project such that top level hdlmake directory is now a package. Added…

Refactored project such that top level hdlmake directory is now a package. Added setup.py for easy packaging of project with setuptools. Note that installation instructions (and how to run hdlmake) has changed!

Related changes:
- hdlmake/_version.py file now exists as a single location to manage the version of hdlmake. This is used by Sphinx docs, setup.py, and hdlmake itself.
- Cleaned up some circular dependencies in hdlmake.fetch package. This changed the design of backend_factory such that it no longer depends on importing git/svn fetchers.
- Added tests/run_tests.py. Right now it has one test which iterates through all of the top level sim and syn Manifest files and attempts to run hdlmake against them. This acts as a crude regression test.
- Added ez_setup.py. This installs setuptools if it is not available in the python environment. This guarantees that setup.py will work.
- Added Manifest.in. This lists non-hdlmake application data that should be included in a source distribution (documentation, test files, etc)
- Updated Sphinx docs to agree with the new package/module structure (with hdlmake as a top level package). Note that the installation instructions have changed.

Stealth changes:
- hdlmake now will return a non-zero exit code when an exception is caught at the top level. Previously the exception was caught and hdlmake exited with 0 exit code. This was confusing because it actually was a failure.
- Fixed a small bug in synthesis_project.py where version_key may not exist in env dictionary, causing an exception, instead of printing the helpful error message.

Rationale:
- Packages are the means of sharing Python code. The whole application should be bundled in a package.
- Easier distribution of project via setuptools
- Installation via setup.py / setuptools automatically creates executable hdlmake script
- Utilizing setuptools allows for possibility of distributing releases via PyPI.
- Possible to import from any module in hdlmake for purposes of unit testing without sys.path hacking.
parent 8cd9c99c
...@@ -8,4 +8,10 @@ hdlmake.log ...@@ -8,4 +8,10 @@ hdlmake.log
*.swap *.swap
*.odt *.odt
*.orig *.orig
.svn *.pyc
\ No newline at end of file *.egg-info/
.svn
/pyenv/
/cyg_pyenv/
docs/_build
dist/
include COPYING
include ez_setup.py
recursive-include docs *
recursive-include scripts *
recursive-include tests *
prune docs/_build
...@@ -52,10 +52,18 @@ copyright = u'2013-2015, CERN' ...@@ -52,10 +52,18 @@ copyright = u'2013-2015, CERN'
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version.
version = '2.1' # Hook the common version file to get our version information
exec(open(os.path.abspath(os.path.join('..','hdlmake','_version.py'))).read())
try:
__version__
except Exception:
__version__ = '0.0' # default if for some reason the exec did not work
version = __version__
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '2.1' release = __version__
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
...@@ -265,5 +273,5 @@ texinfo_documents = [ ...@@ -265,5 +273,5 @@ texinfo_documents = [
#texinfo_no_detailmenu = False #texinfo_no_detailmenu = False
# Path to sources # Path to sources
sys.path.insert(0, os.path.abspath('../hdlmake')) sys.path.insert(0, os.path.abspath('../'))
dep_file module
===============
.. automodule:: dep_file
:members:
:undoc-members:
:show-inheritance:
dep_solver module
=================
.. automodule:: dep_solver
:members:
:undoc-members:
:show-inheritance:
dependable_file module
======================
.. automodule:: dependable_file
:members:
:undoc-members:
:show-inheritance:
env module
==========
.. automodule:: env
:members:
:undoc-members:
:show-inheritance:
global_mod module
=================
.. automodule:: global_mod
:members:
:undoc-members:
:show-inheritance:
hdlmake.action package
======================
Submodules
----------
hdlmake.action.action module
----------------------------
.. automodule:: hdlmake.action.action
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.check_condition module
-------------------------------------
.. automodule:: hdlmake.action.check_condition
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.check_manifest module
------------------------------------
.. automodule:: hdlmake.action.check_manifest
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.clean module
---------------------------
.. automodule:: hdlmake.action.clean
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.fetch module
---------------------------
.. automodule:: hdlmake.action.fetch
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.fetch_makefile module
------------------------------------
.. automodule:: hdlmake.action.fetch_makefile
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.list_files module
--------------------------------
.. automodule:: hdlmake.action.list_files
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.list_modules module
----------------------------------
.. automodule:: hdlmake.action.list_modules
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.merge_cores module
---------------------------------
.. automodule:: hdlmake.action.merge_cores
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.remote_synthesis module
--------------------------------------
.. automodule:: hdlmake.action.remote_synthesis
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.simulation module
--------------------------------
.. automodule:: hdlmake.action.simulation
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.synthesis module
-------------------------------
.. automodule:: hdlmake.action.synthesis
:members:
:undoc-members:
:show-inheritance:
hdlmake.action.synthesis_project module
---------------------------------------
.. automodule:: hdlmake.action.synthesis_project
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hdlmake.action
:members:
:undoc-members:
:show-inheritance:
fetch package hdlmake.fetch package
============= =====================
Submodules Submodules
---------- ----------
fetch.backend_factory module hdlmake.fetch.backend_factory module
---------------------------- ------------------------------------
.. automodule:: fetch.backend_factory .. automodule:: hdlmake.fetch.backend_factory
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
fetch.fetcher module hdlmake.fetch.constants module
-------------------- ------------------------------
.. automodule:: hdlmake.fetch.constants
:members:
:undoc-members:
:show-inheritance:
hdlmake.fetch.fetcher module
----------------------------
.. automodule:: fetch.fetcher .. automodule:: hdlmake.fetch.fetcher
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
fetch.git module hdlmake.fetch.git module
---------------- ------------------------
.. automodule:: fetch.git .. automodule:: hdlmake.fetch.git
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
fetch.svn module hdlmake.fetch.svn module
---------------- ------------------------
.. automodule:: fetch.svn .. automodule:: hdlmake.fetch.svn
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -40,7 +48,7 @@ fetch.svn module ...@@ -40,7 +48,7 @@ fetch.svn module
Module contents Module contents
--------------- ---------------
.. automodule:: fetch .. automodule:: hdlmake.fetch
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action package hdlmake package
============== ===============
Subpackages
-----------
.. toctree::
hdlmake.action
hdlmake.fetch
hdlmake.tools
hdlmake.util
Submodules Submodules
---------- ----------
action.action module hdlmake.dep_file module
-------------------- -----------------------
.. automodule:: action.action .. automodule:: hdlmake.dep_file
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.check_condition module hdlmake.dep_solver module
----------------------------- -------------------------
.. automodule:: action.check_condition .. automodule:: hdlmake.dep_solver
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.check_manifest module hdlmake.dependable_file module
---------------------------- ------------------------------
.. automodule:: action.check_manifest .. automodule:: hdlmake.dependable_file
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.clean module hdlmake.env module
------------------- ------------------
.. automodule:: action.clean .. automodule:: hdlmake.env
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.fetch module hdlmake.global_mod module
------------------- -------------------------
.. automodule:: action.fetch .. automodule:: hdlmake.global_mod
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.fetch_makefile module hdlmake.makefile_writer module
---------------------------- ------------------------------
.. automodule:: action.fetch_makefile .. automodule:: hdlmake.makefile_writer
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.list_files module hdlmake.manifest_parser module
------------------------ ------------------------------
.. automodule:: action.list_files .. automodule:: hdlmake.manifest_parser
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.list_modules module hdlmake.module module
-------------------------- ---------------------
.. automodule:: action.list_modules .. automodule:: hdlmake.module
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.merge_cores module hdlmake.module_pool module
------------------------- --------------------------
.. automodule:: action.merge_cores .. automodule:: hdlmake.module_pool
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.remote_synthesis module hdlmake.new_dep_solver module
------------------------------ -----------------------------
.. automodule:: action.remote_synthesis .. automodule:: hdlmake.new_dep_solver
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.simulation module hdlmake.srcfile module
------------------------ ----------------------
.. automodule:: action.simulation .. automodule:: hdlmake.srcfile
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.synthesis module hdlmake.vhdl_parser module
----------------------- --------------------------
.. automodule:: action.synthesis .. automodule:: hdlmake.vhdl_parser
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
action.synthesis_project module hdlmake.vlog_parser module
------------------------------- --------------------------
.. automodule:: action.synthesis_project .. automodule:: hdlmake.vlog_parser
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -112,7 +122,7 @@ action.synthesis_project module ...@@ -112,7 +122,7 @@ action.synthesis_project module
Module contents Module contents
--------------- ---------------
.. automodule:: action .. automodule:: hdlmake
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tools.planahead package hdlmake.tools.aldec package
======================= ===========================
Submodules Submodules
---------- ----------
tools.planahead.planahead module hdlmake.tools.aldec.aldec module
-------------------------------- --------------------------------
.. automodule:: tools.planahead.planahead .. automodule:: hdlmake.tools.aldec.aldec
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.planahead.planahead module ...@@ -16,7 +16,7 @@ tools.planahead.planahead module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.planahead .. automodule:: hdlmake.tools.aldec
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
hdlmake.tools.common package
============================
Submodules
----------
hdlmake.tools.common.sim_makefile_support module
------------------------------------------------
.. automodule:: hdlmake.tools.common.sim_makefile_support
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hdlmake.tools.common
:members:
:undoc-members:
:show-inheritance:
tools.diamond package hdlmake.tools.diamond package
===================== =============================
Submodules Submodules
---------- ----------
tools.diamond.diamond module hdlmake.tools.diamond.diamond module
---------------------------- ------------------------------------
.. automodule:: tools.diamond.diamond .. automodule:: hdlmake.tools.diamond.diamond
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.diamond.diamond module ...@@ -16,7 +16,7 @@ tools.diamond.diamond module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.diamond .. automodule:: hdlmake.tools.diamond
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tools.iverilog package hdlmake.tools.ghdl package
====================== ==========================
Submodules Submodules
---------- ----------
tools.iverilog.iverilog module hdlmake.tools.ghdl.ghdl module
------------------------------ ------------------------------
.. automodule:: tools.iverilog.iverilog .. automodule:: hdlmake.tools.ghdl.ghdl
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.iverilog.iverilog module ...@@ -16,7 +16,7 @@ tools.iverilog.iverilog module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.iverilog .. automodule:: hdlmake.tools.ghdl
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tools.quartus package hdlmake.tools.ise package
===================== =========================
Submodules Submodules
---------- ----------
tools.quartus.quartus module hdlmake.tools.ise.ise module
---------------------------- ----------------------------
.. automodule:: tools.quartus.quartus .. automodule:: hdlmake.tools.ise.ise
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.quartus.quartus module ...@@ -16,7 +16,7 @@ tools.quartus.quartus module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.quartus .. automodule:: hdlmake.tools.ise
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
tools.modelsim package hdlmake.tools.isim package
====================== ==========================
Submodules Submodules
---------- ----------
tools.modelsim.modelsim module hdlmake.tools.isim.isim module
------------------------------ ------------------------------
.. automodule:: tools.modelsim.modelsim .. automodule:: hdlmake.tools.isim.isim
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.modelsim.modelsim module ...@@ -16,7 +16,7 @@ tools.modelsim.modelsim module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.modelsim .. automodule:: hdlmake.tools.isim
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
hdlmake.tools.iverilog package
==============================
Submodules
----------
hdlmake.tools.iverilog.iverilog module
--------------------------------------
.. automodule:: hdlmake.tools.iverilog.iverilog
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hdlmake.tools.iverilog
:members:
:undoc-members:
:show-inheritance:
tools.ise package hdlmake.tools.libero package
================= ============================
Submodules Submodules
---------- ----------
tools.ise.ise module hdlmake.tools.libero.libero module
-------------------- ----------------------------------
.. automodule:: tools.ise.ise .. automodule:: hdlmake.tools.libero.libero
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.ise.ise module ...@@ -16,7 +16,7 @@ tools.ise.ise module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.ise .. automodule:: hdlmake.tools.libero
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
hdlmake.tools.modelsim package
==============================
Submodules
----------
hdlmake.tools.modelsim.modelsim module
--------------------------------------
.. automodule:: hdlmake.tools.modelsim.modelsim
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hdlmake.tools.modelsim
:members:
:undoc-members:
:show-inheritance:
hdlmake.tools.planahead package
===============================
Submodules
----------
hdlmake.tools.planahead.planahead module
----------------------------------------
.. automodule:: hdlmake.tools.planahead.planahead
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hdlmake.tools.planahead
:members:
:undoc-members:
:show-inheritance:
tools.ghdl package hdlmake.tools.quartus package
================== =============================
Submodules Submodules
---------- ----------
tools.ghdl.ghdl module hdlmake.tools.quartus.quartus module
---------------------- ------------------------------------
.. automodule:: tools.ghdl.ghdl .. automodule:: hdlmake.tools.quartus.quartus
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.ghdl.ghdl module ...@@ -16,7 +16,7 @@ tools.ghdl.ghdl module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.ghdl .. automodule:: hdlmake.tools.quartus
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
hdlmake.tools.riviera package
=============================
Submodules
----------
hdlmake.tools.riviera.riviera module
------------------------------------
.. automodule:: hdlmake.tools.riviera.riviera
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hdlmake.tools.riviera
:members:
:undoc-members:
:show-inheritance:
hdlmake.tools package
=====================
Subpackages
-----------
.. toctree::
hdlmake.tools.aldec
hdlmake.tools.common
hdlmake.tools.diamond
hdlmake.tools.ghdl
hdlmake.tools.ise
hdlmake.tools.isim
hdlmake.tools.iverilog
hdlmake.tools.libero
hdlmake.tools.modelsim
hdlmake.tools.planahead
hdlmake.tools.quartus
hdlmake.tools.riviera
hdlmake.tools.vivado
Module contents
---------------
.. automodule:: hdlmake.tools
:members:
:undoc-members:
:show-inheritance:
tools.aldec package hdlmake.tools.vivado package
=================== ============================
Submodules Submodules
---------- ----------
tools.aldec.aldec module hdlmake.tools.vivado.vivado module
------------------------ ----------------------------------
.. automodule:: tools.aldec.aldec .. automodule:: hdlmake.tools.vivado.vivado
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -16,7 +16,7 @@ tools.aldec.aldec module ...@@ -16,7 +16,7 @@ tools.aldec.aldec module
Module contents Module contents
--------------- ---------------
.. automodule:: tools.aldec .. automodule:: hdlmake.tools.vivado
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
util package hdlmake.util package
============ ====================
Submodules Submodules
---------- ----------
util.configparser module hdlmake.util.configparser module
------------------------ --------------------------------
.. automodule:: util.configparser .. automodule:: hdlmake.util.configparser
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
util.path module hdlmake.util.path module
---------------- ------------------------
.. automodule:: util.path .. automodule:: hdlmake.util.path
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
util.termcolor module hdlmake.util.termcolor module
--------------------- -----------------------------
.. automodule:: util.termcolor .. automodule:: hdlmake.util.termcolor
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -32,7 +32,7 @@ util.termcolor module ...@@ -32,7 +32,7 @@ util.termcolor module
Module contents Module contents
--------------- ---------------
.. automodule:: util .. automodule:: hdlmake.util
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -152,29 +152,72 @@ As a prerequisite, you must have the following programs installed in your host m ...@@ -152,29 +152,72 @@ As a prerequisite, you must have the following programs installed in your host m
- ``git``: you need git for both fetching the ``hdlmake`` code and accessing to remote HDL repositories. - ``git``: you need git for both fetching the ``hdlmake`` code and accessing to remote HDL repositories.
- ``svn``: svn will only be used when accessing to remote SVN HDL repositories. - ``svn``: svn will only be used when accessing to remote SVN HDL repositories.
Now, you need to fetch the code from the official ``hdlmake`` git repository, that can be found at the next link: There are two methods to obtain and install ``hdlmake``: via git repository or PyPI. PyPI is the preferred method if you are only interested in releases. Git may be preferred if you are a developer, or would like to stay in sync with active development.
PyPI and ``pip``
~~~~~~~~~~~~~~~~
Installing ``hdlmake`` via PyPI is straightforward assuming that you have ``pip`` already installed in your local Python environment.
.. note:: For directions on installing ``pip`` see the `pip documentation <https://pip.pypa.io/en/latest/installing.html>`_.
To install directly from `PyPI <https://pypi.python.org/pypi>`_ simply run:
.. code-block:: bash
pip install hdlmake
Alternatively, if you have already downloaded a source distribution, you can install it as follows:
.. code-block:: bash
pip install hdlmake-X.X.tar.gz
At this point, ``hdlmake`` is now installed into your active Python environment and can be run simply by executing ``hdlmake`` in your shell.
Git
~~~
Fetch the code from the official ``hdlmake`` git repository, that can be found at the next link:
http://www.ohwr.org/projects/hdl-make/repository http://www.ohwr.org/projects/hdl-make/repository
Once you have a valid ``hdlmake`` source tree, you need to create a launch script in /usr/bin or any other available location at shell $PATH. You can name the script as you prefer so, by doing this, multiple ``hdlmake`` versions can easily be used in the same machine. In any case, in this documentation we will consider that the name for this launch script is just ``hdlmake``. Once you have a valid ``hdlmake`` source tree, you can install ``hdlmake`` into your Python site-packages directly via *setup.py install*:
.. code-block:: bash .. code-block:: bash
cd /path_to_hdlmake_sources/hdl-make
python2.7 setup.py install
``hdlmake`` is now installed into your active Python environment and can be run simply by executing ``hdlmake`` in your shell.
#!/usr/bin/env bash As a developer, you may wish to avoid installing ``hdlmake`` directly into your site-packages, but can instead link directly to the sources instead:
python2.7 /path_to_hdlmake_sources/hdl-make/hdlmake/__main__.py $@
here: .. code-block:: bash
cd /path_to_hdlmake_sources/hdl-make
python2.7 setup.py develop
Alternatively, you may choose to forgo installing anything in your Python environment and simply directly run from the source by creating a launch script.
Create a launch script in /usr/bin or any other available location at shell $PATH. You can name the script as you prefer so, by doing this, multiple ``hdlmake`` versions can easily be used in the same machine. In any case, in this documentation we will consider that the name for this launch script is just ``hdlmake``.
- ``python2.7`` is the executable of the Python deployment we want to use with ``hdlmake``. .. code-block:: bash
- ``path_to_hdlmake_sources`` is the absolute path in which the ``hdlmake`` source code has been fetched.
- ``hdl-make`` is the name of the folder created when you checked out the repo. #!/usr/bin/env bash
- ``hdlmake`` is the subfolder of hdl-make (this is not binary or a file, this is folder name). PYTHONPATH=/path_to_hdlmake_sources/hdl-make python2.7 /path_to_hdlmake_sources/hdl-make -m hdlmake $@
Once the launch script has been created, the appropriated execution rights must be set: Once the launch script has been created, the appropriate execution rights must be set:
.. code-block:: bash .. code-block:: bash
chmod +x /usr/bin/hdlmake chmod +x /usr/bin/hdlmake
In the above examples the following nomenclature is used:
- ``python2.7`` is the executable of the Python deployment we want to use with ``hdlmake``.
- ``path_to_hdlmake_sources`` is the absolute path in which the ``hdlmake`` source code has been fetched.
- ``hdl-make`` is the name of the folder created when you checked out the repo.
- ``hdlmake`` is the actual hdlmake package (this is not binary or a file, this is folder name).
Windows specific guidelines Windows specific guidelines
--------------------------- ---------------------------
...@@ -192,11 +235,11 @@ First, install a valid Cygwin environment for your Windows machine. I order to a ...@@ -192,11 +235,11 @@ First, install a valid Cygwin environment for your Windows machine. I order to a
Once you have installed your Cygwin environment, you can just get into the Cygwin console and operate as if you were inside a Linux machine for both installing and working with ``hdlmake``. Once you have installed your Cygwin environment, you can just get into the Cygwin console and operate as if you were inside a Linux machine for both installing and working with ``hdlmake``.
Environment Environment
----------_ -----------
When working in Linux or Windows inside Cygwin, in order to work with ``hdlmake`` we must assure that the tools executables that are going to be used are accessibles in the shell $PATH. This is a requirement for both simulation and synthesis When working in Linux or Windows inside Cygwin, in order to work with ``hdlmake`` we must assure that the tools executables that are going to be used are accessibles in the shell $PATH. This is a requirement for both simulation and synthesis
..warning:: there is another way to define the specific tools as an environmental variable, but this is buggy and fails when executing some of the actions. The $PATH way is the most easy and stable way to go! .. warning:: there is another way to define the specific tools as an environmental variable, but this is buggy and fails when executing some of the actions. The $PATH way is the most easy and stable way to go!
Learn by example Learn by example
...@@ -806,8 +849,8 @@ a secure TCP/IP connection by using SSL. For this purpose, the following tools n ...@@ -806,8 +849,8 @@ a secure TCP/IP connection by using SSL. For this purpose, the following tools n
+-----------+--------------------------------------------+ +-----------+--------------------------------------------+
.. note:: You'll need a local ISE deployment if you want to regenerate the synthesis Makefile or the ISE project (.xise), .. note:: You'll need a local ISE deployment if you want to regenerate the synthesis Makefile or the ISE project (.xise),
files that are mandatory to perform both local and remote synthesis. But, if you have a valid Makefile and ISE project, you can files that are mandatory to perform both local and remote synthesis. But, if you have a valid Makefile and ISE project, you can
launch the remote synthesis from a local machine in which the ISE toolchain is not installed. launch the remote synthesis from a local machine in which the ISE toolchain is not installed.
Before running the remote synthesis Makefile targets, there are different parameters that need to defined for proper operation. Before running the remote synthesis Makefile targets, there are different parameters that need to defined for proper operation.
These can be defined as shell environmental variables or, alternatively, inside the Makefile itself: These can be defined as shell environmental variables or, alternatively, inside the Makefile itself:
......
makefile_writer module
======================
.. automodule:: makefile_writer
:members:
:undoc-members:
:show-inheritance:
manifest_parser module
======================
.. automodule:: manifest_parser
:members:
:undoc-members:
:show-inheritance:
module module
=============
.. automodule:: module
:members:
:undoc-members:
:show-inheritance:
module_pool module
==================
.. automodule:: module_pool
:members:
:undoc-members:
:show-inheritance:
hdlmake
=======
.. toctree::
:maxdepth: 4
action
dep_file
dep_solver
dependable_file
env
fetch
global_mod
makefile_writer
manifest_parser
module
module_pool
new_dep_solver
srcfile
tools
util
vhdl_parser
vlog_parser
new_dep_solver module
=====================
.. automodule:: new_dep_solver
:members:
:undoc-members:
:show-inheritance:
srcfile module
==============
.. automodule:: srcfile
:members:
:undoc-members:
:show-inheritance:
tools.isim package
==================
Submodules
----------
tools.isim.isim module
----------------------
.. automodule:: tools.isim.isim
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: tools.isim
:members:
:undoc-members:
:show-inheritance:
tools.libero package
====================
Submodules
----------
tools.libero.libero module
--------------------------
.. automodule:: tools.libero.libero
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: tools.libero
:members:
:undoc-members:
:show-inheritance:
tools package
=============
Subpackages
-----------
.. toctree::
tools.aldec
tools.diamond
tools.ghdl
tools.ise
tools.isim
tools.iverilog
tools.libero
tools.modelsim
tools.planahead
tools.quartus
Module contents
---------------
.. automodule:: tools
:members:
:undoc-members:
:show-inheritance:
vhdl_parser module
==================
.. automodule:: vhdl_parser
:members:
:undoc-members:
:show-inheritance:
vlog_parser module
==================
.. automodule:: vlog_parser
:members:
:undoc-members:
:show-inheritance:
This diff is collapsed.
...@@ -24,18 +24,20 @@ ...@@ -24,18 +24,20 @@
from __future__ import print_function from __future__ import print_function
import os import os
import importlib import importlib
import global_mod
import argparse import argparse
import logging import logging
import sys import sys
from util.termcolor import colored
from manifest_parser import ManifestParser from . import global_mod
from module_pool import ModulePool from .util.termcolor import colored
from env import Env from .manifest_parser import ManifestParser
import fetch as fetch_mod from .module_pool import ModulePool
from action import (CheckCondition, CleanModules, FetchModules, GenerateFetchMakefile, ListFiles, from .env import Env
from . import fetch as fetch_mod
from .action import (CheckCondition, CleanModules, FetchModules, GenerateFetchMakefile, ListFiles,
ListModules, MergeCores, GenerateSimulationMakefile, ListModules, MergeCores, GenerateSimulationMakefile,
GenerateSynthesisMakefile, GenerateRemoteSynthesisMakefile, GenerateSynthesisProject) GenerateSynthesisMakefile, GenerateRemoteSynthesisMakefile, GenerateSynthesisProject)
from ._version import __version__
#from argument_parser import get_argument_parser #from argument_parser import get_argument_parser
...@@ -121,7 +123,7 @@ def main(): ...@@ -121,7 +123,7 @@ def main():
tool_name = top_mod.sim_tool tool_name = top_mod.sim_tool
logging.info('import tool module: ' + tool_name) logging.info('import tool module: ' + tool_name)
try: try:
tool_module = importlib.import_module("tools.%s.%s" % (tool_name, tool_name)) tool_module = importlib.import_module("hdlmake.tools.%s.%s" % (tool_name, tool_name))
except Exception as e: except Exception as e:
logging.error(e) logging.error(e)
quit() quit()
...@@ -213,6 +215,7 @@ def main(): ...@@ -213,6 +215,7 @@ def main():
logging.error(e) logging.error(e)
print("Trace:") print("Trace:")
traceback.print_exc() traceback.print_exc()
sys.exit("Exiting in failure because exception occurred")
def _get_parser(): def _get_parser():
...@@ -221,11 +224,11 @@ def _get_parser(): ...@@ -221,11 +224,11 @@ def _get_parser():
""" """
usage = """hdlmake [command] [options]""" usage = """hdlmake [command] [options]"""
description = """Version 2.1\n description = """Version %s\n
To see optional arguments for particular command type: To see optional arguments for particular command type:
hdlmake <command> --help hdlmake <command> --help
\0 \0
""" """ % (__version__,)
parser = argparse.ArgumentParser("hdlmake", parser = argparse.ArgumentParser("hdlmake",
usage=usage, usage=usage,
...@@ -264,6 +267,7 @@ def _get_parser(): ...@@ -264,6 +267,7 @@ def _get_parser():
condition_check.add_argument("--condition", dest="condition", required=True) condition_check.add_argument("--condition", dest="condition", required=True)
auto = subparsers.add_parser("auto", help="default action for hdlmake. Run when no args are given") auto = subparsers.add_parser("auto", help="default action for hdlmake. Run when no args are given")
auto.add_argument('-v', '--version', action='version', version=parser.prog + " " + __version__)
auto.add_argument("--force", help="force hdlmake to generate the makefile, even if the specified tool is missing", default=False, action="store_true") auto.add_argument("--force", help="force hdlmake to generate the makefile, even if the specified tool is missing", default=False, action="store_true")
auto.add_argument("--noprune", help="prevent hdlmake from pruning unneeded files", default=False, action="store_true") auto.add_argument("--noprune", help="prevent hdlmake from pruning unneeded files", default=False, action="store_true")
auto.add_argument("--generate-project-vhd", help="generate project.vhd file with a meta package describing the project", auto.add_argument("--generate-project-vhd", help="generate project.vhd file with a meta package describing the project",
......
__version__ = "2.1-jsmith_setuppy"
...@@ -20,16 +20,16 @@ ...@@ -20,16 +20,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from check_condition import CheckCondition from .check_condition import CheckCondition
from check_manifest import CheckManifest from .check_manifest import CheckManifest
from clean import CleanModules from .clean import CleanModules
from fetch import FetchModules from .fetch import FetchModules
from fetch_makefile import GenerateFetchMakefile from .fetch_makefile import GenerateFetchMakefile
from list_files import ListFiles from .list_files import ListFiles
from list_modules import ListModules from .list_modules import ListModules
from merge_cores import MergeCores from .merge_cores import MergeCores
from synthesis_project import GenerateSynthesisProject from .synthesis_project import GenerateSynthesisProject
from synthesis import GenerateSynthesisMakefile from .synthesis import GenerateSynthesisMakefile
from remote_synthesis import GenerateRemoteSynthesisMakefile from .remote_synthesis import GenerateRemoteSynthesisMakefile
from simulation import GenerateSimulationMakefile from .simulation import GenerateSimulationMakefile
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
import sys import sys
import logging import logging
from makefile_writer import MakefileWriter
class Action(object): class Action(object):
......
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
from __future__ import print_function from __future__ import print_function
import logging import logging
import sys import sys
from action import Action
import re import re
from .action import Action
class CheckCondition(Action): class CheckCondition(Action):
def _compare(self, local, reference, cond): def _compare(self, local, reference, cond):
......
...@@ -19,10 +19,9 @@ ...@@ -19,10 +19,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from action import Action
import logging import logging
import global_mod
from manifest_parser import ManifestParser from .action import Action
class CheckManifest(Action): class CheckManifest(Action):
......
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from action import Action
import logging import logging
from .action import Action
class CleanModules(Action): class CleanModules(Action):
def run(self): def run(self):
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
import logging import logging
import sys import sys
from action import Action
from .action import Action
class FetchModules(Action): class FetchModules(Action):
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from action import Action
import global_mod
import logging import logging
from hdlmake import global_mod
from .action import Action
class GenerateFetchMakefile(Action): class GenerateFetchMakefile(Action):
def run(self): def run(self):
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from action import Action from .action import Action
class ListFiles(Action): class ListFiles(Action):
......
...@@ -20,11 +20,13 @@ ...@@ -20,11 +20,13 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import from __future__ import absolute_import
from action.action import Action
from util import path
import fetch
from hdlmake.util import path
import hdlmake.fetch as fetch
from .action import Action
def _convert_to_source_name(source_code): def _convert_to_source_name(source_code):
if source_code == fetch.GIT: if source_code == fetch.GIT:
return "git" return "git"
......
...@@ -21,14 +21,16 @@ ...@@ -21,14 +21,16 @@
from __future__ import print_function from __future__ import print_function
import logging import logging
from action import Action
from srcfile import VerilogFile, VHDLFile, NGCFile
from vlog_parser import VerilogPreprocessor
import os import os
import os.path import os.path
import time import time
import sys import sys
from hdlmake.srcfile import VerilogFile, VHDLFile, NGCFile
from hdlmake.vlog_parser import VerilogPreprocessor
from .action import Action
class MergeCores(Action): class MergeCores(Action):
def _check_manifest(self): def _check_manifest(self):
......
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from action import Action
import logging import logging
import os import os
import sys import sys
import global_mod
from srcfile import SourceFileFactory
import importlib from hdlmake import global_mod
from hdlmake.srcfile import SourceFileFactory
from .action import Action
class GenerateRemoteSynthesisMakefile(Action): class GenerateRemoteSynthesisMakefile(Action):
......
...@@ -21,15 +21,14 @@ ...@@ -21,15 +21,14 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function from __future__ import print_function
from action import Action
from dep_file import DepFile
import new_dep_solver as dep_solver
import logging import logging
import sys import sys
import global_mod
import importlib from hdlmake.dep_file import DepFile
import hdlmake.new_dep_solver as dep_solver
from hdlmake import global_mod
from .action import Action
class GenerateSimulationMakefile(Action): class GenerateSimulationMakefile(Action):
......
...@@ -21,15 +21,12 @@ ...@@ -21,15 +21,12 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function from __future__ import print_function
from dep_file import DepFile
import new_dep_solver as dep_solver
import logging import logging
import sys import sys
import global_mod
from action import Action
import importlib from hdlmake import global_mod
from .action import Action
class GenerateSynthesisMakefile(Action): class GenerateSynthesisMakefile(Action):
......
...@@ -22,18 +22,15 @@ ...@@ -22,18 +22,15 @@
from __future__ import print_function from __future__ import print_function
import logging import logging
from action import Action
import sys import sys
import os import os
import new_dep_solver as dep_solver
from srcfile import SourceFileFactory
from dependable_file import DependableFile
import global_mod
from util import path
import importlib
from hdlmake.srcfile import SourceFileFactory
from hdlmake.dependable_file import DependableFile
from hdlmake import global_mod
from hdlmake.util import path
from .action import Action
class GenerateSynthesisProject(Action): class GenerateSynthesisProject(Action):
...@@ -150,7 +147,7 @@ end sdb_meta_pkg;""") ...@@ -150,7 +147,7 @@ end sdb_meta_pkg;""")
if self.env[path_key] is None: if self.env[path_key] is None:
logging.error("Can't generate the " + name + " project. " + name + " not found.") logging.error("Can't generate the " + name + " project. " + name + " not found.")
quit() quit()
if not env[version_key]: if version_key not in env or not env[version_key]:
logging.error(name + " version cannot be deduced. Cannot generate " + name + " " logging.error(name + " version cannot be deduced. Cannot generate " + name + " "
"project file properly. Please use syn_" + id_value + "_version in the manifest " "project file properly. Please use syn_" + id_value + "_version in the manifest "
"or set") "or set")
......
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
import global_mod
import os import os
from util import path as path_mod
from . import global_mod
from .util import path as path_mod
class DepRelation(object): class DepRelation(object):
...@@ -141,7 +142,7 @@ class File(object): ...@@ -141,7 +142,7 @@ class File(object):
class DepFile(File): class DepFile(File):
def __init__(self, file_path, module, include_paths=None): def __init__(self, file_path, module, include_paths=None):
from module import Module from .module import Module
assert isinstance(file_path, basestring) assert isinstance(file_path, basestring)
assert isinstance(module, Module) assert isinstance(module, Module)
...@@ -159,7 +160,7 @@ class DepFile(File): ...@@ -159,7 +160,7 @@ class DepFile(File):
self.include_paths = include_paths self.include_paths = include_paths
def _parse_if_needed(self): def _parse_if_needed(self):
from new_dep_solver import ParserFactory from .new_dep_solver import ParserFactory
if not self.is_parsed: if not self.is_parsed:
parser = ParserFactory().create(self) parser = ParserFactory().create(self)
parser.parse(self) parser.parse(self)
......
...@@ -23,10 +23,11 @@ ...@@ -23,10 +23,11 @@
import re import re
import os import os
import logging import logging
import global_mod
from srcfile import SourceFileFactory, SourceFileSet, SourceFile from . import global_mod
from srcfile import VHDLFile, VerilogFile, SVFile from .srcfile import SourceFileFactory, SourceFileSet, SourceFile
from dependable_file import DependableFile from .srcfile import VHDLFile, VerilogFile, SVFile
from .dependable_file import DependableFile
class DependencySolver(object): class DependencySolver(object):
...@@ -225,7 +226,7 @@ def solve(fileset): ...@@ -225,7 +226,7 @@ def solve(fileset):
vhdl_solver = VHDLDependencySolver() vhdl_solver = VHDLDependencySolver()
vhdl_solver.solve(vhdl_files) vhdl_solver.solve(vhdl_files)
import srcfile as sf from . import srcfile as sf
verilog_files = [file for file in fset if isinstance(file, VerilogFile)] verilog_files = [file for file in fset if isinstance(file, VerilogFile)]
verilog_solver = VerilogDependencySolver() verilog_solver = VerilogDependencySolver()
......
...@@ -25,14 +25,12 @@ from __future__ import print_function ...@@ -25,14 +25,12 @@ from __future__ import print_function
import os import os
import sys import sys
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import re
import logging
import os.path import os.path
from util import path
from util.termcolor import colored
import global_mod from .util import path
import importlib from .util.termcolor import colored
from . import global_mod
_plain_print = print _plain_print = print
......
...@@ -19,12 +19,6 @@ ...@@ -19,12 +19,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from backend_factory import BackendFactory from .constants import (GIT, GITSUBMODULE, SVN, LOCAL, fetch_type_lookup)
from svn import Svn from .git import Git
from git import Git from .svn import Svn
GIT = 1
SVN = 2
LOCAL = 3
GITSUBMODULE = 4
...@@ -19,34 +19,29 @@ ...@@ -19,34 +19,29 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from git import (Git, GitSubmodule)
from svn import Svn
import logging import logging
import fetch from .constants import (LOCAL)
from fetcher import Fetcher
class Local(Fetcher):
def __init__(self):
pass
def fetch(self, module):
pass
class BackendFactory(object): class BackendFactory(object):
def __init__(self): def __init__(self):
pass self.backend_table = {}
def register_backend(self, backend_id, backend):
"""Add a mapping: backend_id -> backend"""
self.backend_table[backend_id] = backend
def get_backend(self, module): def get_backend(self, module):
if module.source == fetch.LOCAL: try:
return Local() if module.source != LOCAL:
else:
logging.info("Investigating module: " + str(module) + logging.info("Investigating module: " + str(module) +
"[parent: " + str(module.parent) + "]") "[parent: " + str(module.parent) + "]")
if module.source == fetch.SVN: backend = self.backend_table[module.source]
return Svn() except KeyError:
if module.source == fetch.GIT: error_string = "No registered backend found for module: " +\
return Git() str(module) + "\n" +\
if module.source == fetch.GITSUBMODULE: "Registered backends are:\n"
return GitSubmodule() for backend_id in self.backend_table.iterkeys():
error_string += "\t%d" % (backend_id)
logging.error(error_string)
raise # this is serious enough we should let the exception keep going
return backend
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 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/>.
# Note that the order here is important. The constants must be
# defined first! If they are not, there will likely be an obscure error
# when doing the imports within the imports that come afterwards.
GIT = 1
SVN = 2
LOCAL = 3
GITSUBMODULE = 4
from .svn import Svn
from .git import (Git, GitSubmodule)
from .local import Local
from .backend_factory import BackendFactory
# Initialize an instance of BackendFactory which will be made publicly available
fetch_type_lookup = BackendFactory()
fetch_type_lookup.register_backend(GIT, Git)
fetch_type_lookup.register_backend(SVN, Svn)
fetch_type_lookup.register_backend(LOCAL, Local)
fetch_type_lookup.register_backend(GITSUBMODULE, GitSubmodule)
...@@ -20,17 +20,17 @@ ...@@ -20,17 +20,17 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import os import os
from util import path from hdlmake.util import path
import logging import logging
from tempfile import TemporaryFile from tempfile import TemporaryFile
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import fetch from .constants import (GIT, GITSUBMODULE)
from fetcher import Fetcher from .fetcher import Fetcher
class GitSubmodule(Fetcher): class GitSubmodule(Fetcher):
def fetch(self, module): def fetch(self, module):
if module.source != fetch.GITSUBMODULE: if module.source != GITSUBMODULE:
raise ValueError("This backend should get git modules only.") raise ValueError("This backend should get git modules only.")
cur_dir = os.getcwd() cur_dir = os.getcwd()
os.chdir(module.fetchto) os.chdir(module.fetchto)
...@@ -112,7 +112,7 @@ submodule.ip_cores/wr-cores.url=git://ohwr.org/hdl-core-lib/wr-cores.git ...@@ -112,7 +112,7 @@ submodule.ip_cores/wr-cores.url=git://ohwr.org/hdl-core-lib/wr-cores.git
return config_submodules return config_submodules
def fetch(self, module): def fetch(self, module):
if module.source != fetch.GIT: if module.source != GIT:
raise ValueError("This backend should get git modules only.") raise ValueError("This backend should get git modules only.")
if not os.path.exists(module.fetchto): if not os.path.exists(module.fetchto):
os.mkdir(module.fetchto) os.mkdir(module.fetchto)
......
#!/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/>.
from .fetcher import Fetcher
class Local(Fetcher):
def __init__(self):
pass
def fetch(self, module):
pass
\ No newline at end of file
...@@ -22,9 +22,11 @@ ...@@ -22,9 +22,11 @@
import os import os
import logging import logging
from tempfile import TemporaryFile from tempfile import TemporaryFile
from util import path
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from fetcher import Fetcher
from hdlmake.util import path
from .fetcher import Fetcher
class Svn(Fetcher): class Svn(Fetcher):
......
...@@ -29,4 +29,4 @@ mod_pool = None ...@@ -29,4 +29,4 @@ mod_pool = None
sim_tool = None sim_tool = None
env = None env = None
tool_module = None tool_module = None
makefile_writer = None
...@@ -22,12 +22,9 @@ ...@@ -22,12 +22,9 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import os import os
import sys
import logging from . import fetch
import string
import fetch
import global_mod
from string import Template
class _StaticClassVariable(): class _StaticClassVariable():
pass pass
......
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from util import path as path_mod
import os import os
from util.configparser import ConfigParser
from .util import path as path_mod
from .util.configparser import ConfigParser
class Manifest: class Manifest:
......
...@@ -21,13 +21,14 @@ ...@@ -21,13 +21,14 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function from __future__ import print_function
from manifest_parser import Manifest, ManifestParser
from util import path as path_mod
import os import os
import global_mod
import logging
import fetch
import sys import sys
import logging
from .manifest_parser import Manifest, ManifestParser
from .util import path as path_mod
from . import global_mod
from . import fetch
class Module(object): class Module(object):
...@@ -47,7 +48,7 @@ class Module(object): ...@@ -47,7 +48,7 @@ class Module(object):
@property @property
def basename(self): def basename(self):
from util import path from .util import path
if self.source == fetch.SVN: if self.source == fetch.SVN:
return path.svn_basename(self.url) return path.svn_basename(self.url)
else: else:
...@@ -231,7 +232,7 @@ class Module(object): ...@@ -231,7 +232,7 @@ class Module(object):
self.manifest_dict = opt_map self.manifest_dict = opt_map
def process_manifest(self): def process_manifest(self):
from srcfile import TCLFile, VerilogFile, VHDLFile, SourceFileSet from .srcfile import TCLFile, VerilogFile, VHDLFile, SourceFileSet
if self.isprocessed is True: if self.isprocessed is True:
return return
if self.manifest_dict is None: if self.manifest_dict is None:
...@@ -508,7 +509,7 @@ class Module(object): ...@@ -508,7 +509,7 @@ class Module(object):
return modules return modules
def _create_file_list_from_paths(self, paths): def _create_file_list_from_paths(self, paths):
from srcfile import SourceFileFactory, SourceFileSet from .srcfile import SourceFileFactory, SourceFileSet
sff = SourceFileFactory() sff = SourceFileFactory()
srcs = SourceFileSet() srcs = SourceFileSet()
for p in paths: for p in paths:
......
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
from __future__ import print_function from __future__ import print_function
import os import os
import logging import logging
import global_mod
import sys
import new_dep_solver as dep_solver
from util import path as path_mod
import fetch
from subprocess import PIPE, Popen from subprocess import PIPE, Popen
import sys
from . import global_mod
from . import new_dep_solver as dep_solver
from .util import path as path_mod
from . import fetch
class ModulePool(list): class ModulePool(list):
...@@ -65,7 +66,7 @@ class ModulePool(list): ...@@ -65,7 +66,7 @@ class ModulePool(list):
This is the only way to add new modules to the pool. Thanks to it the pool can easily This is the only way to add new modules to the pool. Thanks to it the pool can easily
control its content control its content
""" """
from module import Module from .module import Module
self._deps_solved = False self._deps_solved = False
if source != fetch.LOCAL: if source != fetch.LOCAL:
clean_url, branch, revision = path_mod.url_parse(url) clean_url, branch, revision = path_mod.url_parse(url)
...@@ -134,7 +135,7 @@ class ModulePool(list): ...@@ -134,7 +135,7 @@ class ModulePool(list):
os.chdir(cwd) os.chdir(cwd)
def _add(self, new_module): def _add(self, new_module):
from module import Module from .module import Module
if not isinstance(new_module, Module): if not isinstance(new_module, Module):
raise RuntimeError("Expecting a Module instance") raise RuntimeError("Expecting a Module instance")
if self.__contains(new_module): if self.__contains(new_module):
...@@ -149,8 +150,7 @@ class ModulePool(list): ...@@ -149,8 +150,7 @@ class ModulePool(list):
new_modules = [] new_modules = []
logging.debug("Fetching module: " + str(module)) logging.debug("Fetching module: " + str(module))
bf = fetch.BackendFactory() fetcher = fetch.fetch_type_lookup.get_backend(module)
fetcher = bf.get_backend(module)
result = fetcher.fetch(module) result = fetcher.fetch(module)
if result is False: if result is False:
logging.error("Unable to fetch module %s" % module.url) logging.error("Unable to fetch module %s" % module.url)
...@@ -197,7 +197,7 @@ class ModulePool(list): ...@@ -197,7 +197,7 @@ class ModulePool(list):
def build_file_set(self): def build_file_set(self):
"""Build set of all files listed in the manifests""" """Build set of all files listed in the manifests"""
from srcfile import SourceFileSet from .srcfile import SourceFileSet
all_manifested_files = SourceFileSet() all_manifested_files = SourceFileSet()
for module in self: for module in self:
all_manifested_files.add(module.files) all_manifested_files.add(module.files)
...@@ -206,7 +206,7 @@ class ModulePool(list): ...@@ -206,7 +206,7 @@ class ModulePool(list):
def build_global_file_set(self): def build_global_file_set(self):
"""Build set of all files from manifests plus all include files from sources""" """Build set of all files from manifests plus all include files from sources"""
from srcfile import SourceFileSet from .srcfile import SourceFileSet
files = self.build_file_set() files = self.build_file_set()
assert isinstance(files, SourceFileSet) assert isinstance(files, SourceFileSet)
self.solve_dependencies() self.solve_dependencies()
......
...@@ -23,11 +23,10 @@ ...@@ -23,11 +23,10 @@
from __future__ import print_function from __future__ import print_function
import logging import logging
from dep_file import DepFile
from srcfile import VHDLFile, VerilogFile, SVFile from .dep_file import DepFile
from .srcfile import VHDLFile, VerilogFile, SVFile
import global_mod from . import global_mod
class DepParser(object): class DepParser(object):
...@@ -41,8 +40,8 @@ class DepParser(object): ...@@ -41,8 +40,8 @@ class DepParser(object):
class ParserFactory(object): class ParserFactory(object):
def create(self, dep_file): def create(self, dep_file):
import re import re
from vlog_parser import VerilogParser from .vlog_parser import VerilogParser
from vhdl_parser import VHDLParser from .vhdl_parser import VHDLParser
if isinstance(dep_file, VHDLFile) : if isinstance(dep_file, VHDLFile) :
return VHDLParser(dep_file) return VHDLParser(dep_file)
...@@ -74,8 +73,8 @@ class ParserFactory(object): ...@@ -74,8 +73,8 @@ class ParserFactory(object):
def solve(fileset): def solve(fileset):
from srcfile import SourceFileSet from .srcfile import SourceFileSet
from dep_file import DepRelation from .dep_file import DepRelation
assert isinstance(fileset, SourceFileSet) assert isinstance(fileset, SourceFileSet)
fset = fileset.filter(DepFile) fset = fileset.filter(DepFile)
......
...@@ -23,18 +23,18 @@ ...@@ -23,18 +23,18 @@
from __future__ import print_function from __future__ import print_function
#from dependable_file import DependableFile #from dependable_file import DependableFile
import os import os
import global_mod
import logging import logging
from module import Module
from util import path as path_mod from .module import Module
from dep_file import DepFile, File from .util import path as path_mod
from .dep_file import DepFile, File
class SourceFile(DepFile): class SourceFile(DepFile):
cur_index = 0 cur_index = 0
def __init__(self, path, module, library=None): def __init__(self, path, module, library=None):
from dep_file import DepFile from .dep_file import DepFile
assert isinstance(path, basestring) assert isinstance(path, basestring)
assert isinstance(module, Module) assert isinstance(module, Module)
self.library = library self.library = library
......
...@@ -21,12 +21,9 @@ ...@@ -21,12 +21,9 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
import string import string
from string import Template
import fetch from hdlmake.makefile_writer import MakefileWriter
from makefile_writer import MakefileWriter
import logging
class ToolControls(MakefileWriter): class ToolControls(MakefileWriter):
...@@ -49,7 +46,7 @@ class ToolControls(MakefileWriter): ...@@ -49,7 +46,7 @@ class ToolControls(MakefileWriter):
def generate_simulation_makefile(self, fileset, top_module): def generate_simulation_makefile(self, fileset, top_module):
# TODO: ?? # TODO: ??
from srcfile import VHDLFile, VerilogFile, SVFile from hdlmake.srcfile import VHDLFile, VerilogFile, SVFile
makefile_tmplt_1 = string.Template("""TOP_MODULE := ${top_module} makefile_tmplt_1 = string.Template("""TOP_MODULE := ${top_module}
ALDEC_CRAP := \ ALDEC_CRAP := \
run.command \ run.command \
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
from makefile_writer import MakefileWriter
import os import os
import string import string
from string import Template
from hdlmake.makefile_writer import MakefileWriter
class VsimMakefileWriter(MakefileWriter): class VsimMakefileWriter(MakefileWriter):
...@@ -63,12 +63,12 @@ class VsimMakefileWriter(MakefileWriter): ...@@ -63,12 +63,12 @@ class VsimMakefileWriter(MakefileWriter):
The Makefile format is shared, but flags, dependencies, clean rules, The Makefile format is shared, but flags, dependencies, clean rules,
etc are defined by the specific tool. etc are defined by the specific tool.
""" """
from srcfile import VerilogFile, VHDLFile, SVFile from hdlmake.srcfile import VerilogFile, VHDLFile, SVFile
self.vlog_flags.append(self.__get_rid_of_vsim_incdirs(top_module.vlog_opt)) self.vlog_flags.append(self.__get_rid_of_vsim_incdirs(top_module.vlog_opt))
self.vcom_flags.append(top_module.vcom_opt) self.vcom_flags.append(top_module.vcom_opt)
self.vmap_flags.append(top_module.vmap_opt) self.vmap_flags.append(top_module.vmap_opt)
self.vsim_flags.append(top_module.vsim_opt) self.vsim_flags.append(top_module.vsim_opt)
tmp = """## variables ############################# tmp = """## variables #############################
PWD := $(shell pwd) PWD := $(shell pwd)
...@@ -194,7 +194,7 @@ sim_post_cmd: ...@@ -194,7 +194,7 @@ sim_post_cmd:
# self.write(incdir) # self.write(incdir)
# self.writeln(vl.vlog_opt+" $<") # self.writeln(vl.vlog_opt+" $<")
#### ####
compile_template = Template("\t\tvlog -work ${library} $$(VLOG_FLAGS) ${sv_option} +incdir+${include_dirs} ${vlog_opt} $$<") compile_template = string.Template("\t\tvlog -work ${library} $$(VLOG_FLAGS) ${sv_option} +incdir+${include_dirs} ${vlog_opt} $$<")
compile_line = compile_template.substitute(library=vl.library, compile_line = compile_template.substitute(library=vl.library,
sv_option="-sv" if isinstance(vl, SVFile) else "", sv_option="-sv" if isinstance(vl, SVFile) else "",
include_dirs='+'.join(vl.include_dirs), include_dirs='+'.join(vl.include_dirs),
......
...@@ -24,14 +24,10 @@ ...@@ -24,14 +24,10 @@
import subprocess import subprocess
import sys import sys
import os import os
import logging import logging
import string import string
from string import Template
import fetch
from makefile_writer import MakefileWriter from hdlmake.makefile_writer import MakefileWriter
DIAMOND_STANDARD_LIBS = ['ieee', 'std'] DIAMOND_STANDARD_LIBS = ['ieee', 'std']
...@@ -197,7 +193,7 @@ mrproper: ...@@ -197,7 +193,7 @@ mrproper:
def __emit_files(self, update=False): def __emit_files(self, update=False):
tmp = 'prj_src {0} \"{1}\"' tmp = 'prj_src {0} \"{1}\"'
ret = [] ret = []
from srcfile import VHDLFile, VerilogFile, SVFile, EDFFile, LPFFile from hdlmake.srcfile import VHDLFile, VerilogFile, SVFile, EDFFile, LPFFile
for f in self.files: for f in self.files:
line = '' line = ''
if isinstance(f, VHDLFile) or isinstance(f, VerilogFile) or isinstance(f, SVFile) or isinstance(f, EDFFile): if isinstance(f, VHDLFile) or isinstance(f, VerilogFile) or isinstance(f, SVFile) or isinstance(f, EDFFile):
......
...@@ -21,13 +21,8 @@ ...@@ -21,13 +21,8 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
import string import string
from string import Template from hdlmake.makefile_writer import MakefileWriter
import fetch
from makefile_writer import MakefileWriter
import logging
class ToolControls(MakefileWriter): class ToolControls(MakefileWriter):
...@@ -53,7 +48,7 @@ class ToolControls(MakefileWriter): ...@@ -53,7 +48,7 @@ class ToolControls(MakefileWriter):
def generate_simulation_makefile(self, fileset, top_module): def generate_simulation_makefile(self, fileset, top_module):
# TODO: vhdl87 vs vhdl97 options # TODO: vhdl87 vs vhdl97 options
from srcfile import VHDLFile from hdlmake.srcfile import VHDLFile
makefile_tmplt_1 = string.Template("""TOP_MODULE := ${top_module} makefile_tmplt_1 = string.Template("""TOP_MODULE := ${top_module}
GHDL_CRAP := \ GHDL_CRAP := \
......
...@@ -26,18 +26,13 @@ import xml.dom.minidom ...@@ -26,18 +26,13 @@ import xml.dom.minidom
import xml.parsers.expat import xml.parsers.expat
import logging import logging
import re import re
import global_mod
import os import os
import sys
from subprocess import Popen, PIPE
import new_dep_solver as dep_solver
import string import string
from string import Template from subprocess import Popen, PIPE
import fetch
from makefile_writer import MakefileWriter from hdlmake import global_mod
import hdlmake.new_dep_solver as dep_solver
from hdlmake.makefile_writer import MakefileWriter
XmlImpl = xml.dom.minidom.getDOMImplementation() XmlImpl = xml.dom.minidom.getDOMImplementation()
...@@ -105,7 +100,6 @@ class ToolControls(MakefileWriter): ...@@ -105,7 +100,6 @@ class ToolControls(MakefileWriter):
def generate_remote_synthesis_makefile(self, files, name, cwd, user, server): def generate_remote_synthesis_makefile(self, files, name, cwd, user, server):
from subprocess import PIPE, Popen
if name is None: if name is None:
import random import random
name = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8)) name = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
...@@ -452,7 +446,7 @@ mrproper: ...@@ -452,7 +446,7 @@ mrproper:
return new return new
def _output_files(self, node): def _output_files(self, node):
from srcfile import UCFFile, VHDLFile, VerilogFile, CDCFile, NGCFile from hdlmake.srcfile import UCFFile, VHDLFile, VerilogFile, CDCFile, NGCFile
for f in self.files: for f in self.files:
fp = self.xml_doc.createElement("file") fp = self.xml_doc.createElement("file")
...@@ -486,7 +480,7 @@ mrproper: ...@@ -486,7 +480,7 @@ mrproper:
node.appendChild(fp) node.appendChild(fp)
def _output_bindings(self, node): def _output_bindings(self, node):
from srcfile import CDCFile from hdlmake.srcfile import CDCFile
for b in [f for f in self.files if isinstance(f, CDCFile)]: for b in [f for f in self.files if isinstance(f, CDCFile)]:
bp = self.xml_doc.createElement("binding") bp = self.xml_doc.createElement("binding")
bp.setAttribute("xil_pn:location", self.top_mod.syn_top) bp.setAttribute("xil_pn:location", self.top_mod.syn_top)
......
...@@ -23,18 +23,15 @@ ...@@ -23,18 +23,15 @@
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
# #
import os
import os.path import os.path
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import logging
import os
import sys import sys
import string import string
from string import Template
import fetch
import global_mod
from makefile_writer import MakefileWriter from hdlmake import global_mod
from hdlmake.makefile_writer import MakefileWriter
ISIM_STANDARD_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys', ISIM_STANDARD_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys',
...@@ -65,15 +62,15 @@ class ToolControls(MakefileWriter): ...@@ -65,15 +62,15 @@ class ToolControls(MakefileWriter):
stdout=PIPE) stdout=PIPE)
print os.path.join(path, "vlogcomp") print os.path.join(path, "vlogcomp")
try: try:
isim_version = isim.stdout.readlines()[0].strip() isim_version = isim.stdout.readlines()[0].strip()
except: except:
return None return None
return isim_version return isim_version
def generate_simulation_makefile(self, fileset, top_module): def generate_simulation_makefile(self, fileset, top_module):
from srcfile import VerilogFile, VHDLFile from hdlmake.srcfile import VerilogFile, VHDLFile
#from tools.ise import XilinxsiminiReader #from ..ise import XilinxsiminiReader
make_preambule_p1 = """## variables ############################# make_preambule_p1 = """## variables #############################
PWD := $(shell pwd) PWD := $(shell pwd)
TOP_MODULE := """ + top_module.top_module + """ TOP_MODULE := """ + top_module.top_module + """
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
# #
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import string import string
from string import Template import os
import fetch import logging
from makefile_writer import MakefileWriter from hdlmake import global_mod
from hdlmake.makefile_writer import MakefileWriter
IVERILOG_STANDARD_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys', IVERILOG_STANDARD_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys',
...@@ -66,7 +66,7 @@ class ToolControls(MakefileWriter): ...@@ -66,7 +66,7 @@ class ToolControls(MakefileWriter):
# TODO: include dir # TODO: include dir
from srcfile import VerilogFile, VHDLFile, SVFile from hdlmake.srcfile import VerilogFile, VHDLFile, SVFile
makefile_tmplt_1 = string.Template("""TOP_MODULE := ${top_module} makefile_tmplt_1 = string.Template("""TOP_MODULE := ${top_module}
IVERILOG_CRAP := \ IVERILOG_CRAP := \
...@@ -137,7 +137,7 @@ mrproper: clean ...@@ -137,7 +137,7 @@ mrproper: clean
def generate_iverilog_makefile(self, fileset, top_module, modules_pool): def generate_iverilog_makefile(self, fileset, top_module, modules_pool):
print('javi checkpoint 0') print('javi checkpoint 0')
from srcfile import VerilogFile from hdlmake.srcfile import VerilogFile
for f in global_mod.top_module.incl_makefiles: for f in global_mod.top_module.incl_makefiles:
self.writeln("include " + f) self.writeln("include " + f)
......
...@@ -24,12 +24,10 @@ ...@@ -24,12 +24,10 @@
import subprocess import subprocess
import sys import sys
import os import os
import string import string
from string import Template import logging
import fetch
from makefile_writer import MakefileWriter from hdlmake.makefile_writer import MakefileWriter
LIBERO_STANDARD_LIBS = ['ieee', 'std'] LIBERO_STANDARD_LIBS = ['ieee', 'std']
...@@ -190,7 +188,7 @@ mrproper: ...@@ -190,7 +188,7 @@ mrproper:
synthesis_constraints = [] synthesis_constraints = []
compilation_constraints = [] compilation_constraints = []
ret = [] ret = []
from srcfile import VHDLFile, VerilogFile, SDCFile, PDCFile from hdlmake.srcfile import VHDLFile, VerilogFile, SDCFile, PDCFile
# First stage: linking files # First stage: linking files
for f in self.files: for f in self.files:
if isinstance(f, VHDLFile) or isinstance(f, VerilogFile): if isinstance(f, VHDLFile) or isinstance(f, VerilogFile):
......
...@@ -23,17 +23,10 @@ ...@@ -23,17 +23,10 @@
from __future__ import print_function from __future__ import print_function
import xml.dom.minidom import xml.dom.minidom
import xml.parsers.expat
import re
import os import os
import global_mod from hdlmake import global_mod
from ..common.sim_makefile_support import VsimMakefileWriter
import string
from string import Template
import fetch
from .. common.sim_makefile_support import VsimMakefileWriter
XmlImpl = xml.dom.minidom.getDOMImplementation() XmlImpl = xml.dom.minidom.getDOMImplementation()
......
...@@ -24,13 +24,11 @@ ...@@ -24,13 +24,11 @@
import subprocess import subprocess
import sys import sys
import os import os
import string import string
from string import Template from string import Template
import fetch
import logging import logging
from makefile_writer import MakefileWriter from hdlmake.makefile_writer import MakefileWriter
PLANAHEAD_STANDARD_LIBS = ['ieee', 'std'] PLANAHEAD_STANDARD_LIBS = ['ieee', 'std']
...@@ -229,7 +227,7 @@ mrproper: ...@@ -229,7 +227,7 @@ mrproper:
def __emit_files(self): def __emit_files(self):
tmp = "add_files -norecurse {0}" tmp = "add_files -norecurse {0}"
ret = [] ret = []
from srcfile import VHDLFile, VerilogFile, SVFile, UCFFile, NGCFile, XMPFile, XCOFile from hdlmake.srcfile import VHDLFile, VerilogFile, SVFile, UCFFile, NGCFile, XMPFile, XCOFile
for f in self.files: for f in self.files:
if isinstance(f, VHDLFile) or isinstance(f, VerilogFile) or isinstance(f, SVFile) or isinstance(f, UCFFile) or isinstance(f, NGCFile) or isinstance(f, XMPFile) or isinstance(f, XCOFile): if isinstance(f, VHDLFile) or isinstance(f, VerilogFile) or isinstance(f, SVFile) or isinstance(f, UCFFile) or isinstance(f, NGCFile) or isinstance(f, XMPFile) or isinstance(f, XCOFile):
line = tmp.format(f.rel_path()) line = tmp.format(f.rel_path())
......
...@@ -22,13 +22,9 @@ ...@@ -22,13 +22,9 @@
# #
import os import os
import sys
import string import string
from string import Template
import fetch
from makefile_writer import MakefileWriter from hdlmake.makefile_writer import MakefileWriter
QUARTUS_STANDARD_LIBS = ['altera', 'altera_mf', 'lpm', 'ieee', 'std'] QUARTUS_STANDARD_LIBS = ['altera', 'altera_mf', 'lpm', 'ieee', 'std']
...@@ -182,7 +178,7 @@ mrproper: ...@@ -182,7 +178,7 @@ mrproper:
return pre+'\n'+mod+'\n'+post+'\n' return pre+'\n'+mod+'\n'+post+'\n'
def __emit_files(self): def __emit_files(self):
from srcfile import VHDLFile, VerilogFile, SignalTapFile, SDCFile, QIPFile, DPFFile from hdlmake.srcfile import VHDLFile, VerilogFile, SignalTapFile, SDCFile, QIPFile, DPFFile
tmp = "set_global_assignment -name {0} {1}" tmp = "set_global_assignment -name {0} {1}"
ret = [] ret = []
for f in self.files: for f in self.files:
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# #
from __future__ import print_function from __future__ import print_function
from .. common.sim_makefile_support import VsimMakefileWriter from ..common.sim_makefile_support import VsimMakefileWriter
# as of 2014.06, these are the standard libraries # as of 2014.06, these are the standard libraries
# included in an installation # included in an installation
......
...@@ -24,13 +24,10 @@ ...@@ -24,13 +24,10 @@
import subprocess import subprocess
import sys import sys
import os import os
import string import string
from string import Template
import fetch
import logging import logging
from makefile_writer import MakefileWriter from hdlmake.makefile_writer import MakefileWriter
VIVADO_STANDARD_LIBS = ['ieee', 'std'] VIVADO_STANDARD_LIBS = ['ieee', 'std']
...@@ -230,7 +227,7 @@ mrproper: ...@@ -230,7 +227,7 @@ mrproper:
tmp = "add_files -norecurse {0}" tmp = "add_files -norecurse {0}"
tcl = "source {0}" tcl = "source {0}"
ret = [] ret = []
from srcfile import VHDLFile, VerilogFile, SVFile, UCFFile, NGCFile, XMPFile, XCOFile, BDFile, TCLFile from hdlmake.srcfile import VHDLFile, VerilogFile, SVFile, UCFFile, NGCFile, XMPFile, XCOFile, BDFile, TCLFile
for f in self.files: for f in self.files:
if isinstance(f, VHDLFile) or isinstance(f, VerilogFile) or isinstance(f, SVFile) or isinstance(f, UCFFile) or isinstance(f, NGCFile) or isinstance(f, XMPFile) or isinstance(f, XCOFile) or isinstance(f, BDFile): if isinstance(f, VHDLFile) or isinstance(f, VerilogFile) or isinstance(f, SVFile) or isinstance(f, UCFFile) or isinstance(f, NGCFile) or isinstance(f, XMPFile) or isinstance(f, XCOFile) or isinstance(f, BDFile):
line = tmp.format(f.rel_path()) line = tmp.format(f.rel_path())
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Hdlmake. If not, see <http://www.gnu.org/licenses/>. # along with Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from new_dep_solver import DepParser
import logging import logging
import re import re
from .new_dep_solver import DepParser
class VHDLPreprocessor(object): class VHDLPreprocessor(object):
...@@ -55,7 +55,7 @@ class VHDLParser(DepParser): ...@@ -55,7 +55,7 @@ class VHDLParser(DepParser):
def parse(self, dep_file): def parse(self, dep_file):
from dep_file import DepRelation from .dep_file import DepRelation
if dep_file.is_parsed: if dep_file.is_parsed:
return return
logging.info("Parsing %s" % dep_file.path) logging.info("Parsing %s" % dep_file.path)
......
...@@ -28,9 +28,10 @@ import os ...@@ -28,9 +28,10 @@ import os
import re import re
import sys import sys
import logging import logging
from new_dep_solver import DepParser
from dep_file import DepRelation from .new_dep_solver import DepParser
from srcfile import SourceFileFactory from .dep_file import DepRelation
from .srcfile import SourceFileFactory
class VerilogPreprocessor(object): class VerilogPreprocessor(object):
......
import ez_setup
ez_setup.use_setuptools()
from setuptools import (setup, find_packages)
exec(open('hdlmake/_version.py').read())
try:
__version__
except Exception:
__version__ = "0.0" # default if for some reason the exec did not work
setup(
name="hdlmake",
version=__version__,
description="Hdlmake generates multi-purpose makefiles for HDL projects management.",
author="Javier D. Garcia-Lasheras",
author_email="hdl-make@ohwr.org",
license="GPLv3",
url="http://www.ohwr.org/projects/hdl-make",
packages=find_packages(),
entry_points={
'console_scripts': [
'hdlmake = hdlmake.__main__:main',
],
},
include_package_data=True, # use MANIFEST.in during install
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Topic :: Utilities",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Topic :: Software Development :: Build Tools",
],
)
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 CERN
# Author: Joshua Smith (joshrsmith@gmail.com)
#
# 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 os
import subprocess
def test_makefile_generation():
"""This simple function finds top level (action) manifest files based on an
assumed directory structure and attempts to run hdlmake on them. If hdlmake
exits with a successful exit code, it assumes hdlmake was successful.
This is more of an exercise of the code than a check for Makefile correctness.
Assumes python is on the $PATH
"""
this_mod_dir = os.path.dirname(__file__)
failures = []
# Get the absolute path to the hdlmake base project directory, and put it on
# a copied environment's PYTHONPATH. This will later allow us to execute the
# package as a script using "-m" option to python
hdlmakedir = os.path.abspath(os.path.join(this_mod_dir,'..'))
subprocess_env = os.environ.copy()
if "PYTHONPATH" in subprocess_env:
subprocess_env["PYTHONPATH"] = hdlmakedir + ":" + subprocess_env["PYTHONPATH"]
else:
subprocess_env["PYTHONPATH"] = hdlmakedir
manifests_locations = []
for action in ('sim','syn'): # currently only works on sim. The force option does not appear to work on syn targets
for (dirname, subdir_items, filelist) in os.walk(os.path.join(this_mod_dir,'counter',action)):
for filename in filelist:
if "Manifest.py" in filename:
print "Found: " + os.path.join(dirname,filename)
manifests_locations.append(os.path.abspath(dirname))
print "Running hdlmake on found manifests..."
for manifestdir in manifests_locations:
os.chdir(manifestdir)
args = ["python",
"-m",
"hdlmake",
"auto",
"--force"]
try:
subprocess.check_call(args)
except subprocess.CalledProcessError:
print "Error processing manifest in: " + manifestdir
failures.append(manifestdir)
if len(failures) > 0:
print "Problems processing the following Manifest files:"
for failure in failures:
print failure
else:
print "Successfully processed all Manifest files."
def main():
test_makefile_generation()
if __name__ == "__main__":
main()
\ No newline at end of file
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