Skip to content

Commit ddec0a2

Browse files
committed
Updated using 0.0.post48 from https://github.com/litex-hub/litex-data-auto
1 parent 558f746 commit ddec0a2

File tree

5 files changed

+97
-34
lines changed

5 files changed

+97
-34
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
graft litex/data/cpu/vexriscv/verilog/
1+
graft pythondata_cpu_vexriscv/verilog/
22
global-exclude *.py[cod]

README.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,91 @@
1-
# litex-data-cpu-vexriscv
1+
# pythondata-cpu-vexriscv
22

3-
Non-Python data files required to use the vexriscv with
3+
Non-Python files needed for the cpu vexriscv packaged
4+
into a Python module so they can be used with Python libraries and tools.
5+
6+
This Useful for usage with tools like
47
[LiteX](https://github.com/enjoy-digital/litex.git).
58

6-
The data files can be found under the Python module `litex.data.cpu.vexriscv`. The
7-
`litex.data.cpu.vexriscv.location` value can be used to find the files on the file system.
9+
The data files can be found under the Python module `pythondata_cpu_vexriscv`. The
10+
`pythondata_cpu_vexriscv.location` value can be used to find the files on the file system.
811

912
Example of getting the data file directly;
1013
```python
11-
import litex.data.cpu.vexriscv
14+
import pythondata_cpu_vexriscv
1215

1316
my_data_file = "abc.txt"
1417

15-
with open(os.path.join(litex.data.cpu.vexriscv.data_location, my_data_file)) as f:
18+
with open(os.path.join(pythondata_cpu_vexriscv.data_location, my_data_file)) as f:
1619
print(f.read())
1720
```
1821

1922
Example of getting the data file using `litex.data.find` API;
2023
```python
21-
from litex.data.find import find_data
24+
from pythondata_cpu_vexriscv import data_file
2225

2326
my_data_file = "abc.txt"
2427

25-
with open(os.path.join(find_data("cpu", "vexriscv"), my_data_file)) as f:
28+
with open(data_file(my_data_file)) as f:
2629
print(f.read())
2730
```
2831

2932

3033

3134
The data files are generated from https://github.com/SpinalHDL/VexRISCV.git and place in the directory
32-
[litex/data/cpu/vexriscv/verilog](litex/data/cpu/vexriscv/verilog).
35+
[pythondata_cpu_vexriscv/verilog](pythondata_cpu_vexriscv/verilog).
3336

3437

35-
## Installing
38+
## Installing from git repository
3639

3740
## Manually
3841

3942
You can install the package manually, however this is **not** recommended.
4043

4144
```
42-
git clone https://github.com/litex-hub/litex-data-cpu-vexriscv.git
43-
cd litex-data-cpu-vexriscv
45+
git clone https://github.com/litex-hub/pythondata-cpu-vexriscv.git
46+
cd pythondata-cpu-vexriscv
4447
sudo python setup.py install
4548
```
4649

47-
## Using [pip](https://pip.pypa.io/)
50+
## Using [pip](https://pip.pypa.io/) with git repository
4851

4952
You can use [pip](https://pip.pypa.io/) to install the data package directly
5053
from github using;
5154

5255
```
53-
pip install --user git+https://github.com/litex-hub/litex-data-cpu-vexriscv.git
56+
pip install --user git+https://github.com/litex-hub/pythondata-cpu-vexriscv.git
5457
```
5558

5659
If you want to install for the whole system rather than just the current user,
5760
you need to remove the `--user` argument and run as sudo like so;
5861

5962
```
60-
sudo pip install git+https://github.com/litex-hub/litex-data-cpu-vexriscv.git
63+
sudo pip install git+https://github.com/litex-hub/pythondata-cpu-vexriscv.git
6164
```
6265

6366
You can install a specific revision of the repository using;
6467
```
65-
pip install --user git+https://github.com/litex-hub/litex-data-cpu-vexriscv.git@<tag>
66-
pip install --user git+https://github.com/litex-hub/litex-data-cpu-vexriscv.git@<branch>
67-
pip install --user git+https://github.com/litex-hub/litex-data-cpu-vexriscv.git@<hash>
68+
pip install --user git+https://github.com/litex-hub/pythondata-cpu-vexriscv.git@<tag>
69+
pip install --user git+https://github.com/litex-hub/pythondata-cpu-vexriscv.git@<branch>
70+
pip install --user git+https://github.com/litex-hub/pythondata-cpu-vexriscv.git@<hash>
6871
```
6972

7073
### With `requirements.txt` file
7174

7275
Add to your Python `requirements.txt` file using;
7376
```
74-
-e git+https://github.com/litex-hub/litex-data-cpu-vexriscv.git
77+
-e git+https://github.com/litex-hub/pythondata-cpu-vexriscv.git
7578
```
7679

7780
To use a specific revision of the repository, use the following;
7881
```
79-
-e https://github.com/litex-hub/litex-data-cpu-vexriscv.git@<hash>
82+
-e https://github.com/litex-hub/pythondata-cpu-vexriscv.git@<hash>
83+
```
84+
85+
## Installing from [PyPi](https://pypi.org/project/pythondata-cpu-vexriscv/)
86+
87+
## Using [pip](https://pip.pypa.io/)
88+
89+
```
90+
pip install --user pythondata-cpu-vexriscv
8091
```

pythondata_cpu_vexriscv/__init__.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import os.path
2+
__dir__ = os.path.split(os.path.abspath(os.path.realpath(__file__)))[0]
3+
data_location = os.path.join(__dir__, "verilog")
4+
src = "https://github.com/SpinalHDL/VexRISCV.git"
5+
6+
# Module version
7+
version_str = "1.0.1.post313"
8+
version_tuple = (1, 0, 1, 313)
9+
try:
10+
from packaging.version import Version as V
11+
pversion = V("1.0.1.post313")
12+
except ImportError:
13+
pass
14+
15+
# Data version info
16+
data_version_str = "1.0.1.post265"
17+
data_version_tuple = (1, 0, 1)
18+
try:
19+
from packaging.version import Version as V
20+
pdata_version = V("1.0.1.post265")
21+
except ImportError:
22+
pass
23+
data_git_hash = "5f0c7a7faf6b65c907a93be6e3723e297d37ee71"
24+
data_git_describe = "v1.0.1-265-g5f0c7a7"
25+
data_git_msg = """\
26+
27+
"""
28+
29+
# Tool version info
30+
tool_version_str = "0.0.post48"
31+
tool_version_tuple = (0, 0, 48)
32+
try:
33+
from packaging.version import Version as V
34+
ptool_version = V("0.0.post48")
35+
except ImportError:
36+
pass
37+
38+
39+
def data_file(f):
40+
"""Get absolute path for file inside pythondata_cpu_vexriscv."""
41+
fn = os.path.join(data_location, f)
42+
fn = os.path.abspath(fn)
43+
if not os.path.exists(fn):
44+
raise IOError("File {f} doesn't exist in pythondata_cpu_vexriscv".format(f))
45+
return fn

setup.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
with open("README.md", "r") as fh:
44
long_description = fh.read()
55

6-
from litex.data.cpu.vexriscv import version_str
6+
from pythondata_cpu_vexriscv import version_str
77

88
setuptools.setup(
9-
name="litex-data-cpu-vexriscv",
9+
name="pythondata-cpu-vexriscv",
1010
version=version_str,
1111
author="LiteX Authors",
1212
author_email="[email protected]",
13-
description="Python module containing data files for using the VexRISCV cpu with LiteX.",
13+
description="""\
14+
Python module containing verilog files for VexRISCV cpu.""",
1415
long_description=long_description,
1516
long_description_content_type="text/markdown",
16-
url="https://github.com/litex-hub/litex-data-cpu-vexriscv",
17+
url="https://github.com/litex-hub/pythondata-cpu-vexriscv",
1718
classifiers=[
1819
"Programming Language :: Python :: 3",
1920
"License :: OSI Approved :: MIT License",
@@ -22,6 +23,12 @@
2223
python_requires='>=3.5',
2324
zip_safe=False,
2425
packages=setuptools.find_packages(),
25-
package_data={'litex.data.cpu.vexriscv': ['litex/data/cpu/vexriscv/verilog/**']},
26+
package_data={
27+
'cpu_vexriscv': ['cpu_vexriscv/verilog/**'],
28+
},
2629
include_package_data=True,
30+
project_urls={
31+
"Bug Tracker": "https://github.com/litex-hub/pythondata-cpu-vexriscv/issues",
32+
"Source Code": "https://github.com/litex-hub/pythondata-cpu-vexriscv",
33+
},
2734
)

test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env python3
22
import os
33

4-
from litex.data.cpu import vexriscv
4+
import pythondata_cpu_vexriscv
55

6-
print("Found vexriscv @ version", vexriscv.version_str, "(with data", vexriscv.data_version_str, ")")
6+
print("Found vexriscv @ version", pythondata_cpu_vexriscv.version_str, "(with data", pythondata_cpu_vexriscv.data_version_str, ")")
77
print()
8-
print("Data is in", vexriscv.data_location)
9-
assert os.path.exists(vexriscv.data_location)
10-
print("Data is version", vexriscv.data_version_str, vexriscv.data_git_hash)
8+
print("Data is in", pythondata_cpu_vexriscv.data_location)
9+
assert os.path.exists(pythondata_cpu_vexriscv.data_location)
10+
print("Data is version", pythondata_cpu_vexriscv.data_version_str, pythondata_cpu_vexriscv.data_git_hash)
1111
print("-"*75)
12-
print(vexriscv.data_git_msg)
12+
print(pythondata_cpu_vexriscv.data_git_msg)
1313
print("-"*75)
1414
print()
1515
print("It contains:")
16-
for root, dirs, files in os.walk(vexriscv.data_location):
16+
for root, dirs, files in os.walk(pythondata_cpu_vexriscv.data_location):
1717
dirs.sort()
1818
for f in sorted(files):
19-
path = os.path.relpath(os.path.join(root, f), vexriscv.data_location)
19+
path = os.path.relpath(os.path.join(root, f), pythondata_cpu_vexriscv.data_location)
2020
print(" -", path)

0 commit comments

Comments
 (0)