-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
58 lines (51 loc) · 1.64 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import shutil
from distutils.dir_util import copy_tree
from setuptools import find_packages, setup
# global variables
board = os.environ['BOARD']
repo_board_folder = f'boards/{board}'
repo_notebook_folder = f'notebooks'
board_notebooks_dir = os.environ['PYNQ_JUPYTER_NOTEBOOKS']
package_name = 'pynq_agc'
hw_data_files = ['assets/styles.css']
# check whether board is supported
def check_env():
if not os.path.isdir(repo_board_folder):
raise ValueError("Board {} is not supported.".format(board))
if not os.path.isdir(board_notebooks_dir):
raise ValueError(
"Directory {} does not exist.".format(board_notebooks_dir))
# copy overlays to python package
def copy_overlay():
src_ol_dir = os.path.join(repo_board_folder, 'bin')
dst_ol_dir = os.path.join(package_name)
copy_tree(src_ol_dir, dst_ol_dir)
hw_data_files.extend(
[os.path.join("..", dst_ol_dir, f) for f in os.listdir(dst_ol_dir)])
# copy notebooks to jupyter home
def copy_notebooks():
src_nb_dir = os.path.join(repo_notebook_folder)
dst_nb_dir = os.path.join(board_notebooks_dir, package_name)
if os.path.exists(dst_nb_dir):
shutil.rmtree(dst_nb_dir)
copy_tree(src_nb_dir, dst_nb_dir)
check_env()
copy_overlay()
copy_notebooks()
setup(
name=package_name,
version='0.3.4',
install_requires=[
'pynq>=2.7',
'plotly>=4.5.2',
'jupyter_dash',
'dash_bootstrap_components',
'dash>=1.19.0'
],
author="Craig Ramsay",
packages=find_packages(),
package_data={
'': hw_data_files,
},
description="PYNQ demonstrator for Automatic Gain Control circuits")