Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
73db09c3
Commit
73db09c3
authored
5 months ago
by
Rasmus Sode Lund
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in fstring
parent
b64a7bcd
No related branches found
No related tags found
1 merge request
!281
Fix bug in fstring
Pipeline
#66140
passed with warnings
5 months ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/utils/installer.py
+11
-5
11 additions, 5 deletions
wetb/utils/installer.py
with
11 additions
and
5 deletions
wetb/utils/installer.py
+
11
−
5
View file @
73db09c3
...
@@ -13,8 +13,12 @@ from urllib import request
...
@@ -13,8 +13,12 @@ from urllib import request
import
ssl
import
ssl
import
certifi
import
certifi
def
urlopen
(
*
args
,
**
kwargs
):
def
urlopen
(
*
args
,
**
kwargs
):
return
request
.
urlopen
(
*
args
,
**
kwargs
,
context
=
ssl
.
create_default_context
(
cafile
=
certifi
.
where
()))
return
request
.
urlopen
(
*
args
,
**
kwargs
,
context
=
ssl
.
create_default_context
(
cafile
=
certifi
.
where
())
)
def
chmod_x
(
exe_path
:
str
):
def
chmod_x
(
exe_path
:
str
):
"""
Utility function to change the file mode of a file to allow execution
"""
Utility function to change the file mode of a file to allow execution
...
@@ -46,7 +50,7 @@ def install_wind_tool(
...
@@ -46,7 +50,7 @@ def install_wind_tool(
"""
"""
# Escape backslash if windowspath is given
# Escape backslash if windowspath is given
destination
=
Path
(
destination
.
encode
(
'
unicode_escape
'
).
decode
()).
as_posix
()
destination
=
Path
(
destination
.
encode
(
"
unicode_escape
"
).
decode
()).
as_posix
()
if
tool
is
None
:
if
tool
is
None
:
print
(
"
No tool has been given for install. Nothing has been installed.
"
)
print
(
"
No tool has been given for install. Nothing has been installed.
"
)
...
@@ -76,7 +80,7 @@ def install_wind_tool(
...
@@ -76,7 +80,7 @@ def install_wind_tool(
# Check if requested version is available, and default it is not.
# Check if requested version is available, and default it is not.
if
version
is
not
None
and
version
not
in
versions
[
tool
][
"
available
"
]:
if
version
is
not
None
and
version
not
in
versions
[
tool
][
"
available
"
]:
print
(
print
(
f
"
Version
'
{
version
}
'
of
'
{
tool
}
'
is not available - defaulting to the latest version:
'
{
versions
[
tool
][
"
latest
"
]
}
'"
f
"
Version
'
{
version
}
'
of
'
{
tool
}
'
is not available - defaulting to the latest version:
'
{
versions
[
tool
][
'
latest
'
]
}
'"
)
)
version
=
versions
[
tool
][
"
latest
"
]
version
=
versions
[
tool
][
"
latest
"
]
elif
version
is
None
:
elif
version
is
None
:
...
@@ -130,12 +134,14 @@ def install_hawc2_dtu_license():
...
@@ -130,12 +134,14 @@ def install_hawc2_dtu_license():
if
sys
.
platform
.
lower
()
==
"
win32
"
:
if
sys
.
platform
.
lower
()
==
"
win32
"
:
f
=
Path
(
os
.
getenv
(
"
APPDATA
"
))
/
"
DTU Wind Energy/hawc2/license.cfg
"
f
=
Path
(
os
.
getenv
(
"
APPDATA
"
))
/
"
DTU Wind Energy/hawc2/license.cfg
"
else
:
else
:
f
=
Path
.
home
()
/
'
.config/hawc2/license.cfg
'
f
=
Path
.
home
()
/
"
.config/hawc2/license.cfg
"
if
not
f
.
exists
():
if
not
f
.
exists
():
f
.
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
f
.
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
r
=
urlopen
(
"
http://license-internal.windenergy.dtu.dk:34523
"
).
read
()
r
=
urlopen
(
"
http://license-internal.windenergy.dtu.dk:34523
"
).
read
()
if
b
"
LICENSE SERVER RUNNING
"
in
r
:
if
b
"
LICENSE SERVER RUNNING
"
in
r
:
f
.
write_text
(
"
[licensing]
\n
host = http://license-internal.windenergy.dtu.dk
\n
port = 34523
"
)
f
.
write_text
(
"
[licensing]
\n
host = http://license-internal.windenergy.dtu.dk
\n
port = 34523
"
)
else
:
else
:
raise
ConnectionError
(
raise
ConnectionError
(
f
"
Could not connect to the DTU license server. You must be connected to the DTU network to use this function.
"
f
"
Could not connect to the DTU license server. You must be connected to the DTU network to use this function.
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment