Skip to content

Commit

Permalink
Merge pull request #43 from MrPowerScripts/python3
Browse files Browse the repository at this point in the history
Python 3
  • Loading branch information
MrPowerScripts authored May 8, 2020
2 parents 5a4a4e7 + 3c887b7 commit bae8225
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 60 deletions.
4 changes: 2 additions & 2 deletions Aptfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ make
pkg-config
wget
tmux
python2.7
python-pip
python3.6
python3-pip
python-setuptools
python-dev
git
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: python2 ./src/run.py
worker: python3 ./src/run.py
25 changes: 13 additions & 12 deletions run_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,28 @@ if [ ! -d "$DIR/venv" ]; then
pkg-config \
wget \
tmux \
python2.7 \
python-pip \
python3.6 \
python3-pip \
python-setuptools \
python-dev \
python3-dev \
git || { echo 'Installing dependencies failed' | tee -a $DEBUG_FILE ; exit 1; }

pip install virtualenv || { echo 'Installing virtualenv failed' | tee -a $DEBUG_FILE ; exit 1; }
virtualenv -p $(command -v python2.7) venv || { echo 'Installing virtualenv failed' | tee -a $DEBUG_FILE ; exit 1; }
source venv/bin/activate
pip2 install wheel || { echo 'Installing wheel failed' | tee -a $DEBUG_FILE ; exit 1; }
pip2 install --upgrade pip wheel -r ./src/requirements.txt || { echo 'Installing python deps failed' | tee -a $DEBUG_FILE ; exit 1; }

else
echo "No suitable linux version" | tee -a $DEBUG_FILE
exit

fi
fi

if [ "${machine}" = "Linux" ] || [ "${machine}" = "Mac" ]; then
pip3 install virtualenv || { echo 'Installing virtualenv failed' | tee -a $DEBUG_FILE ; exit 1; }
virtualenv -p "$(command -v python3)" venv || { echo 'Installing virtualenv failed' | tee -a $DEBUG_FILE ; exit 1; }
source venv/bin/activate
pip3 install cython
pip3 install -r ./src/requirements.txt || { echo 'Installing python deps failed' | tee -a $DEBUG_FILE ; exit 1; }
fi

echo "activating the virtualenv " | tee -a $DEBUG_FILE
source venv/bin/activate

echo "trying to run the bot" | tee -a $DEBUG_FILE
python2.7 ./src/run.py "$@"
python3 ./src/run.py "$@"

2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-2.7.17
python-3.6
2 changes: 1 addition & 1 deletion src/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ def check_first_run():
db_dates.insert({"first_run": int(time.time())})
else:
log.info("This is the first bot run ever. Exciting!")
log.info('bot first ran: '.format(db_dates.search(dates['first_run'])))
log.info('bot first ran before')
3 changes: 0 additions & 3 deletions src/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

import sys

reload(sys)
sys.setdefaultencoding("utf8")

import praw
import requests
from bs4 import BeautifulSoup
Expand Down
17 changes: 3 additions & 14 deletions requirements.txt → src/requirements.old
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,26 @@ backports.functools-lru-cache==1.4
beautifulsoup4==4.7.1
certifi==2017.4.17
chardet==3.0.4
Click==7.0
cobe==2.1.2
Cython==0.29.11
Flask==1.1.0
idna==2.5
inflect==0.2.5
irc==12.1.1
itsdangerous==1.1.0
jaraco.classes==1.4.1
jaraco.collections==1.5.1
jaraco.functools==1.16
jaraco.itertools==2.0.1
jaraco.logging==1.5
jaraco.text==1.9.2
Jinja2==2.10.1
MarkupSafe==1.1.1
memory-profiler==0.55.0
more-itertools==3.2.0
nltk==3.4
praw==6.0.0
prawcore==1.0.0
psutil==5.6.3
PyStemmer==1.3.0
pytz==2017.2
regex==2020.2.20
requests==2.22.0
requests>=2.20.0
singledispatch==3.4.0.3
six==1.10.0
soupsieve==1.9.2
tempora==1.8
tinydb==3.15.2
update-checker==0.16
urllib3==1.25.3
Werkzeug==0.15.4
urllib3>=1.23
tinydb==3.15.2
85 changes: 60 additions & 25 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,62 @@
backports.functools-lru-cache==1.4
beautifulsoup4==4.7.1
certifi==2017.4.17
attrs==19.3.0
backports.functools-lru-cache==1.6.1
beautifulsoup4==4.9.0
certifi==2020.4.5.1
chardet==3.0.4
cobe==2.1.2
idna==2.5
inflect==0.2.5
irc==12.1.1
jaraco.classes==1.4.1
jaraco.collections==1.5.1
jaraco.functools==1.16
jaraco.itertools==2.0.1
jaraco.logging==1.5
jaraco.text==1.9.2
more-itertools==3.2.0
nltk==3.4
praw==6.0.0
prawcore==1.0.0
PyStemmer==1.3.0
pytz==2017.2
requests>=2.20.0
click==7.1.2
cobe==3.0.0
configparser==5.0.0
contextlib2==0.6.0.post1
Cython==0.29.17
Flask==1.1.2
idna==2.9
importlib-metadata==1.6.0
importlib-resources==1.5.0
inflect==4.1.0
irc==18.0.0
itsdangerous==1.1.0
jaraco.classes==3.1.0
jaraco.collections==3.0.0
jaraco.functools==3.0.1
jaraco.itertools==5.0.0
jaraco.logging==3.0.0
jaraco.stream==3.0.0
jaraco.text==3.2.0
Jinja2==2.11.2
joblib==0.14.1
MarkupSafe==1.1.1
memory-profiler==0.57.0
more-itertools==8.2.0
mypy==0.770
mypy-extensions==0.4.3
nltk==3.5
packaging==20.3
pathlib2==2.3.5
pluggy==0.13.1
praw==7.0.0
prawcore==1.3.0
psutil==5.7.0
py==1.8.1
pyparsing==2.4.7
PyStemmer==2.0.0.1
pytest==5.4.1
pytest-mypy==0.4.2
pytz==2020.1
regex==2020.4.4
requests==2.23.0
scandir==1.10.0
singledispatch==3.4.0.3
six==1.10.0
tempora==1.8
update-checker==0.16
urllib3>=1.23
tinydb==3.15.2
six==1.14.0
soupsieve==2.0
tempora==3.0.0
tinydb==4.0.0.post1
tqdm==4.46.0
typed-ast==1.4.1
typing==3.7.4.1
typing-extensions==3.7.4.2
update-checker==0.17
urllib3==1.25.9
wcwidth==0.1.9
websocket-client==0.57.0
Werkzeug==1.0.1
zipp==3.1.0
2 changes: 1 addition & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def is_past_one_day(time_to_compare):

def countdown(seconds):
log.info("sleeping: " + str(seconds) + " seconds")
for i in xrange(seconds, 0, -1):
for i in range(seconds, 0, -1):
print("\x1b[2K\r" + str(i) + " ")
time.sleep(1)
log.info("waking up")
Expand Down

0 comments on commit bae8225

Please sign in to comment.