Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: pip install . && pip install sphinx sphinx-rtd-theme
- name: Build documentation
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ name: 'lint'

on:
push:
paths:
paths: &shared_paths
- 'examples/**'
- 'pyfpga/**'
- 'tests/**'
pull_request:
paths: *shared_paths

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: pip install pycodestyle pylint
run: pip install jinja2 pycodestyle pylint
- name: Run linting
run: make lint
File renamed without changes.
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ name: 'test'

on:
push:
paths:
paths: &shared_paths
- 'examples/projects/**'
- 'pyfpga/**'
- 'tests/**'
pull_request:
paths: *shared_paths

jobs:
test:
Expand All @@ -25,7 +27,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.os }} | ${{ matrix.pyver }}
steps:
- name: Checkout repository
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.pyver }}
uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion pyfpga/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""PyFPGA"""

__version__ = '0.4.0'
__version__ = '0.5.0'
19 changes: 13 additions & 6 deletions pyfpga/gowin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ def _make_custom(self):
if 'part' not in self.data:
self.data['part'] = 'GW2AR-LV18QN88C8/I7'

# pylint: disable=duplicate-code

def _get_bitstream(self, bitstream=None):
if not bitstream:
project = self.data['project']
pnr_dir = Path(self.odir) / project / 'impl' / 'pnr'

for ext in self.conf['prog_bit']:
candidate = (
Path(self.odir) /
f'{self.data["project"]}/impl/pnr/{self.data["project"]}.{ext}'
)
candidate = pnr_dir / f'{project}.{ext}'
if candidate.is_file():
bitstream = candidate
break
if not bitstream or not Path(bitstream).is_file():
else:
bitstream = Path(bitstream)

if not bitstream or not bitstream.is_file():
raise FileNotFoundError(bitstream)
return self._get_absolute(bitstream, self.conf['prog_ext'])

abs_path = self._get_absolute(bitstream, self.conf['prog_ext'])
return Path(abs_path).as_posix()
1 change: 1 addition & 0 deletions tests/mocks/gw_sh.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@echo off & python "%~dp0%~n0" %*
Loading