Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Mojtaba Abdolkhani
ogs
Commits
274bd2ab
Verified
Commit
274bd2ab
authored
2 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
[cmake] Create Jupyter Lab config in venv.
Sets markdown files to be opened as Jupyter Notebooks in JLab.
parent
69c96cca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/cmake/PythonSetup.cmake
+20
-4
20 additions, 4 deletions
scripts/cmake/PythonSetup.cmake
with
20 additions
and
4 deletions
scripts/cmake/PythonSetup.cmake
+
20
−
4
View file @
274bd2ab
...
@@ -9,9 +9,10 @@ if(OGS_USE_PYTHON)
...
@@ -9,9 +9,10 @@ if(OGS_USE_PYTHON)
endif
()
endif
()
if
(
OGS_USE_PIP
)
if
(
OGS_USE_PIP
)
set
(
Python_ROOT_DIR
${
PROJECT_BINARY_DIR
}
/.venv
)
set
(
LOCAL_VIRTUALENV_DIR
${
PROJECT_BINARY_DIR
}
/.venv CACHE INTERNAL
""
)
set
(
Python_ROOT_DIR
${
LOCAL_VIRTUALENV_DIR
}
)
set
(
CMAKE_REQUIRE_FIND_PACKAGE_Python TRUE
)
set
(
CMAKE_REQUIRE_FIND_PACKAGE_Python TRUE
)
if
(
NOT EXISTS
${
PROJECT_BINARY_DIR
}
/.venv
)
if
(
NOT EXISTS
${
LOCAL_VIRTUALENV_DIR
}
)
execute_process
(
execute_process
(
COMMAND
COMMAND
${
CMAKE_COMMAND
}
-DPROJECT_BINARY_DIR=
${
PROJECT_BINARY_DIR
}
${
CMAKE_COMMAND
}
-DPROJECT_BINARY_DIR=
${
PROJECT_BINARY_DIR
}
...
@@ -35,7 +36,7 @@ if(OGS_USE_PIP)
...
@@ -35,7 +36,7 @@ if(OGS_USE_PIP)
if
(
MSVC
)
if
(
MSVC
)
set
(
_venv_bin_dir
"Scripts"
)
set
(
_venv_bin_dir
"Scripts"
)
endif
()
endif
()
set
(
LOCAL_VIRTUALENV_BIN_DIR
${
PROJECT_BINARY_DIR
}
/.venv
/
${
_venv_bin_dir
}
set
(
LOCAL_VIRTUALENV_BIN_DIR
${
LOCAL_VIRTUALENV_DIR
}
/
${
_venv_bin_dir
}
CACHE INTERNAL
""
CACHE INTERNAL
""
)
)
# Fixes macOS install issues
# Fixes macOS install issues
...
@@ -43,6 +44,21 @@ if(OGS_USE_PIP)
...
@@ -43,6 +44,21 @@ if(OGS_USE_PIP)
COMMAND
${
LOCAL_VIRTUALENV_BIN_DIR
}
/pip install wheel
COMMAND
${
LOCAL_VIRTUALENV_BIN_DIR
}
/pip install wheel
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
)
)
# Create jupytext config
file
(
WRITE
${
LOCAL_VIRTUALENV_DIR
}
/etc/jupyter/labconfig/default_setting_overrides.json
[=[
{
"@jupyterlab/docmanager-extension:plugin": {
"defaultViewers": {
"markdown": "Jupytext Notebook",
"myst": "Jupytext Notebook"
}
}
}
]=]
)
else
()
else
()
# Prefer unix location over frameworks (Apple-only)
# Prefer unix location over frameworks (Apple-only)
set
(
Python_FIND_FRAMEWORK LAST
)
set
(
Python_FIND_FRAMEWORK LAST
)
...
@@ -77,7 +93,7 @@ if(OGS_USE_PIP)
...
@@ -77,7 +93,7 @@ if(OGS_USE_PIP)
set
(
OGS_PYTHON_PACKAGES
""
set
(
OGS_PYTHON_PACKAGES
""
CACHE INTERNAL
"List of Python packages to be installed via pip."
CACHE INTERNAL
"List of Python packages to be installed via pip."
)
)
set
(
Python_ROOT_DIR
${
PROJECT_BINARY_DIR
}
/.venv
)
set
(
Python_ROOT_DIR
${
LOCAL_VIRTUALENV_DIR
}
)
if
(
MSVC
)
if
(
MSVC
)
set
(
Python_EXECUTABLE
${
Python_ROOT_DIR
}
/Scripts/python.exe
)
set
(
Python_EXECUTABLE
${
Python_ROOT_DIR
}
/Scripts/python.exe
)
else
()
else
()
...
...
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