Skip to content

Commit 1076a6e

Browse files
committed
- version 0.8.9.15
- adding requirements.txt for macOS and Windows
1 parent 2c7ae53 commit 1076a6e

File tree

5 files changed

+47
-108
lines changed

5 files changed

+47
-108
lines changed

README.html

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
133133
<ul>
134134
<li>python 2.7/3.5+
135135
<ul>
136+
<li>setuptools</li>
136137
<li>wheel</li>
137138
<li>requests</li>
138139
<li>dnspython</li>

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ and much more...
8080

8181
## Requirements
8282
* python 2.7/3.5+
83+
- setuptools
8384
- wheel
8485
- requests
8586
- dnspython

devel/build_install_pyradio

+20-1
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,19 @@ then
345345
cd ..
346346
fi
347347

348+
349+
if [ $(uname -s) = "Darwin" ] || [ $(uname -s) = "darwin" ];then
350+
python"${TO_PYTHON}" -m pip install --upgrade setuptools
351+
cat <<END > requirements.txt
352+
wheel
353+
requests
354+
psutil
355+
dnspython
356+
END
357+
else
358+
rm requirements.txt 2>/dev/null
359+
fi
360+
348361
## check dependencies :)
349362
#for prog in git sed ;do
350363
# ${prog} --version 2>/dev/null 1>&2 || {
@@ -381,7 +394,13 @@ sudo find . -iname "*.egg" -delete 2>/dev/null
381394

382395
echo "***** installing for user..."
383396
do_dev
384-
python"${TO_PYTHON}" -m pip install .
397+
398+
if [ -e requirements.txt ];then
399+
python"${TO_PYTHON}" -m pip install -r requirements.txt .
400+
else
401+
python"${TO_PYTHON}" -m pip install .
402+
fi
403+
385404
if [ $? -eq 0 ]
386405
then
387406
[ -z "${NO_DEV}" ] && mv pyradio/config.py.dev pyradio/config.py

devel/build_install_pyradio.bat

+22-107
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@ECHO OFF
2+
SET PROGRAM=python
23
IF "%1"=="--help" GOTO displayhelp
34
IF "%1"=="-h" GOTO displayhelp
45
SETLOCAL EnableDelayedExpansion
@@ -7,112 +8,27 @@ IF EXIST DEV (SET NO_DEV=0) ELSE (SET NO_DEV=1)
78
REM echo(NO_DEV = %NO_DEV%
89
REM GOTO endnopause
910

10-
::net file to test privileges, 1>NUL redirects output, 2>NUL redirects errors
11-
:: https://gist.github.com/neremin/3a4020c172053d837ab37945d81986f6
12-
:: https://stackoverflow.com/questions/13212033/get-windows-version-in-a-batch-file
13-
net session >nul 2>&1
14-
IF "%errorlevel%" == "0" ( GOTO START ) ELSE (
15-
FOR /f "tokens=4-5 delims=. " %%i in ('ver') do SET VERSION=%%i.%%j
16-
IF "%version%" == "6.1" ( GOTO win7exit )
17-
IF "%version%" == "6.0" ( GOTO win7exit )
18-
GOTO getPrivileges
11+
CLS
12+
ECHO Installing / Updating setuptools
13+
%PROGRAM% -m pip install --upgrade setuptools 1>NUL 2>NUL
14+
IF %ERRORLEVEL% == 1 (
15+
SET ERRPKG=windows-curses
16+
GOTO piperror
1917
)
20-
21-
:win7exit
22-
ECHO.
23-
ECHO Error: You must have Administrative permissions to run this script.
24-
ECHO Please start cmd "As Administrator".
25-
ECHO.
26-
ECHO If that does not work, ask the system administrator to
27-
ECHO install PyRadio for you.
28-
ECHO.
29-
GOTO endnopause
30-
31-
:getPrivileges
32-
IF "%version%" == "6.1" ( GOTO win7exit )
33-
IF "%version%" == "6.0" ( GOTO win7exit )
34-
35-
IF "%1"=="" (
36-
CLS
37-
ECHO Installing / Updating python modules
38-
pip install --upgrade windows-curses 1>NUL 2>NUL
39-
IF %ERRORLEVEL% == 1 (
40-
SET ERRPKG=windows-curses
41-
GOTO piperror
42-
)
43-
pip install --upgrade pywin32 1>NUL 2>NUL
44-
IF %ERRORLEVEL% == 1 (
45-
SET ERRPKG=pywin32
46-
GOTO piperror
47-
)
48-
pip install --upgrade requests 1>NUL 2>NUL
49-
IF %ERRORLEVEL% == 1 (
50-
SET ERRPKG=requests
51-
GOTO piperror
52-
)
53-
pip install --upgrade dnspython 1>NUL 2>NUL
54-
IF %ERRORLEVEL% == 1 (
55-
SET ERRPKG=dnspython
56-
GOTO piperror
57-
)
58-
pip install --upgrade psutil 1>NUL 2>NUL
59-
IF %ERRORLEVEL% == 1 (
60-
SET ERRPKG=psutil
61-
GOTO piperror
62-
)
63-
pip install --upgrade patool 1>NUL 2>NUL
64-
IF %ERRORLEVEL% == 1 (
65-
SET ERRPKG=patool
66-
GOTO piperror
67-
)
68-
pip install --upgrade psutil 1>NUL 2>NUL
69-
IF %ERRORLEVEL% == 1 (
70-
SET ERRPKG=pyunpack
71-
GOTO piperror
72-
)
73-
pip install --upgrade wheel 1>NUL 2>NUL
74-
IF %ERRORLEVEL% == 1 (
75-
SET ERRPKG=wheel
76-
GOTO piperror
77-
)
18+
ECHO Installing / Updating windows-curses
19+
%PROGRAM% -m pip install --upgrade windows-curses 1>NUL 2>NUL
20+
IF %ERRORLEVEL% == 1 (
21+
SET ERRPKG=windows-curses
22+
GOTO piperror
7823
)
79-
GOTO START
80-
IF '%1'=='ELEV' ( GOTO START ) ELSE ( ECHO Running elevated in a different window)
81-
ECHO >>DOPAUSE
82-
83-
SET "batchPath=%~f0"
84-
SET "batchArgs=ELEV"
85-
86-
::Add quotes to the batch path, IF needed
87-
SET "script=%0"
88-
SET script=%script:"=%
89-
IF '%0'=='!script!' ( GOTO PathQuotesDone )
90-
SET "batchPath=""%batchPath%"""
91-
:PathQuotesDone
9224

93-
::Add quotes to the arguments, IF needed.
94-
:ArgLoop
95-
IF '%1'=='' ( GOTO EndArgLoop ) ELSE ( GOTO AddArg )
96-
:AddArg
97-
SET "arg=%1"
98-
SET arg=%arg:"=%
99-
IF '%1'=='!arg!' ( GOTO NoQuotes )
100-
SET "batchArgs=%batchArgs% "%1""
101-
GOTO QuotesDone
102-
:NoQuotes
103-
SET "batchArgs=%batchArgs% %1"
104-
:QuotesDone
105-
SHIFT
106-
GOTO ArgLoop
107-
:EndArgLoop
25+
echo pywin32 > requirements.txt
26+
echo requests >> requirements.txt
27+
echo dnspython >> requirements.txt
28+
echo psutil >> requirements.txt
29+
echo wheel >> requirements.txt
30+
echo pylnk >> requirements.txt
10831

109-
::Create and run the vb script to elevate the batch file
110-
ECHO SET UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
111-
ECHO UAC.ShellExecute "cmd", "/c ""!batchPath! !batchArgs!""", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
112-
"%temp%\OEgetPrivileges.vbs"
113-
EXIT /B
114-
115-
:START
11632
::Remove the elevation tag and SET the correct working directory
11733
IF '%1'=='ELEV' ( SHIFT /1 )
11834
CD /d %~dp0
@@ -121,7 +37,6 @@ CD /d %~dp0
12137

12238
CD ..
12339
SET arg1=%1
124-
SET PROGRAM=python
12540

12641

12742
:: Get Desktop LINK FILE
@@ -153,7 +68,7 @@ IF "%NO_DEV%" == "1" (
15368
)
15469

15570
:install
156-
%PROGRAM% -m pip install .
71+
%PROGRAM% -m pip install -r requirements.txt .
15772
IF %ERRORLEVEL% == 0 GOTO installhtml
15873
:installationerror
15974
ECHO.
@@ -189,7 +104,7 @@ ECHO *** HTML files copyed to "%APPDATA%\pyradio\help"
189104

190105
:: Update lnk file
191106
CD pyradio
192-
python -c "from win import create_pyradio_link; create_pyradio_link()"
107+
%PROGRAM% -c "from win import create_pyradio_link; create_pyradio_link()"
193108
CD ..
194109

195110
:: Install lnk file
@@ -198,7 +113,7 @@ COPY /Y %APPDATA%\pyradio\help\*.lnk %DESKTOP% >NUL
198113

199114
:: Clean up
200115
CD pyradio
201-
python -c "from win import clean_up; clean_up()"
116+
%PROGRAM% -c "from win import clean_up; clean_up()"
202117
CD ..
203118
GOTO toend
204119

@@ -297,7 +212,7 @@ IF "%ANS%" == "y" (
297212
)
298213

299214
ECHO IF EXIST dirs DEL dirs >>pyremove.bat
300-
ECHO python -m pip uninstall -y pyradio>>pyremove.bat
215+
ECHO %PROGRAM% -m pip uninstall -y pyradio>>pyremove.bat
301216
ECHO ECHO.>>pyremove.bat
302217
ECHO ECHO.>>pyremove.bat
303218
:: ECHO ECHO PyRadio successfully uninstalled! >>pyremove.bat

pyradio/install.py

+3
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ def update_or_uninstall_on_windows(self, mode='update', from_pyradio=False, firs
561561
with open(bat, "w") as b:
562562
b.write('@ECHO OFF\n')
563563
b.write('CLS\n')
564+
b.write('python -m pip install --upgrade setuptools 1>NUL 2>NUL\n')
565+
b.write('if %ERRORLEVEL% == 1 GOTO downloaderror\n')
564566
b.write('python -m pip install --upgrade requests 1>NUL 2>NUL\n')
565567
b.write('if %ERRORLEVEL% == 1 GOTO downloaderror\n')
566568
b.write('python -m pip install --upgrade wheel 1>NUL 2>NUL\n')
@@ -1083,6 +1085,7 @@ def _do_it(self, mode='update'):
10831085
print('PyRadio is already installed.\n')
10841086
sys.exit(1)
10851087
for a_module in (
1088+
'setuptools',
10861089
'windows-curses',
10871090
'pywin32',
10881091
'dnspython',

0 commit comments

Comments
 (0)