Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Setup Fix for boards (#6)
Browse files Browse the repository at this point in the history
* changed setup to work on desktop as well

* fixed key error

* Amended setup.py so we can install on desktop

* modified setup to allow install on desktop

Co-authored-by: skalade <[email protected]>
  • Loading branch information
dnorthcote and skalade authored Feb 28, 2021
1 parent c8cce98 commit 2655101
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,50 @@

from setuptools import find_packages, setup

import warnings

# global variables
repo_notebook_folder = f'notebooks'
board_notebooks_dir = os.environ['PYNQ_JUPYTER_NOTEBOOKS']
package_name = 'pystrath_dsp'
pip_name = 'pystrath-dsp'
data_files = []

# check whether board is supported
# Get environment variables
def check_env():
if not os.path.isdir(board_notebooks_dir):
raise ValueError(
"Directory {} does not exist.".format(board_notebooks_dir))

notebooks_dir = None
if 'PYNQ_JUPYTER_NOTEBOOKS' not in os.environ:
warnings.warn(
"Use `export PYNQ_JUPYTER_NOTEBOOKS=<desired-notebook-path>` "
"to get the notebooks.",
UserWarning)
# Install to current working directory if not on PYNQ
notebooks_dir = os.getcwd()
else:
notebooks_dir = os.environ['PYNQ_JUPYTER_NOTEBOOKS']

return notebooks_dir

notebooks_dir = None
if 'PYNQ_JUPYTER_NOTEBOOKS' not in os.environ:
warnings.warn(
"Use `export PYNQ_JUPYTER_NOTEBOOKS=<desired-notebook-path>` "
"to get the notebooks.",
UserWarning)
else:
notebooks_dir = os.environ['PYNQ_JUPYTER_NOTEBOOKS']

return notebooks_dir

# copy notebooks to jupyter home
def copy_notebooks():
board_notebooks_dir = check_env()
src_nb_dir = os.path.join(repo_notebook_folder)
dst_nb_dir = os.path.join(board_notebooks_dir, 'dsp-notebooks')
if os.path.exists(dst_nb_dir):
shutil.rmtree(dst_nb_dir)
copy_tree(src_nb_dir, dst_nb_dir)

copy_notebooks()

setup(
name=package_name,
version='0.1',
Expand Down

0 comments on commit 2655101

Please sign in to comment.