Skip to content

Commit c22ec0f

Browse files
committed
Dev Requirements
- add pwd check to the scripts
1 parent 5c131a2 commit c22ec0f

7 files changed

+82
-33
lines changed

scripts/build_frontend.sh

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
cd frontend
2-
npm install
3-
npm run build
1+
#!/bin/bash
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Building the frontend"
7+
cd frontend
8+
npm install
9+
npm run build
10+
fi
11+
12+
13+

scripts/create_test_requirements.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# Create test requirements under test/requirements.txt using requirements.in
2-
cd test
3-
pip install --upgrade pip-tools
4-
pip-compile
1+
#!/bin/bash
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Creating requirements under test/requirements.txt using requirements.in"
7+
cd test
8+
pip install --upgrade pip-tools
9+
pip-compile
10+
fi

scripts/install_gradio.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
pip install -e .
1+
#!/bin/bash
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Installing gradio"
7+
pip install -e .
8+
fi
9+

scripts/install_test_requirements.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
pip install --upgrade pip
2-
pip install -r gradio.egg-info/requires.txt
3-
pip install -r test/requirements.txt
1+
#!/bin/bash
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Installing requirements for tests"
7+
pip install --upgrade pip
8+
pip install -r gradio.egg-info/requires.txt
9+
pip install -r test/requirements.txt
10+
fi
11+

scripts/run_frontend.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
cd frontend
2-
npm start
1+
#!/bin/bash
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Running the frontend"
7+
cd frontend
8+
npm start
9+
fi

scripts/run_tests.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
time python -m unittest
1+
#!/bin/bash
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Running the tests"
7+
python -m unittest
8+
fi

scripts/upload_to_pypi.sh

+22-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
#!/bin/bash
2-
3-
set -e
4-
git pull origin master
5-
6-
old_version=$(ggrep -Po "(?<=version=\")[^\"]+(?=\")" setup.py)
7-
echo "Current version is $old_version. New version?"
8-
read new_version
9-
gsed -i "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py
10-
11-
read -p "frontend updates? " -r
12-
if [[ $REPLY =~ ^[Yy]$ ]]
13-
then
2+
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
3+
echo "Please run the script from repo directory"
4+
exit -1
5+
else
6+
echo "Uploading to pypi"
7+
set -e
8+
git pull origin master
9+
old_version=$(ggrep -Po "(?<=version=\")[^\"]+(?=\")" setup.py)
10+
echo "Current version is $old_version. New version?"
11+
read new_version
12+
gsed -i "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py
13+
read -p "frontend updates? " -r
14+
if [[ $REPLY =~ ^[Yy]$ ]]
15+
then
1416
echo -n $new_version > gradio/version.txt
1517
cd frontend
1618
npm run build
1719
cd ..
1820
aws s3 cp gradio/templates/frontend s3://gradio/$new_version/ --recursive
21+
fi
22+
rm -r dist/*
23+
rm -r build/*
24+
python3 setup.py sdist bdist_wheel
25+
python3 -m twine upload dist/*
26+
git add -A
27+
git commit -m "updated PyPi version to $new_version"
28+
git push origin master
1929
fi
2030

21-
rm -r dist/*
22-
rm -r build/*
23-
python3 setup.py sdist bdist_wheel
24-
python3 -m twine upload dist/*
25-
git add -A
26-
git commit -m "updated PyPi version to $new_version"
27-
git push origin master

0 commit comments

Comments
 (0)