Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shortcut during installation #817

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions construct.yaml
Expand Up @@ -33,6 +33,7 @@ specs:
- pymeep # [unix]
- jax # [unix]
- jaxlib # [unix]
- menuinst # [win]

post_install: install.sh # [linux]
post_install: install.bat # [win]
Expand Down
6 changes: 6 additions & 0 deletions install.bat
Expand Up @@ -4,10 +4,16 @@ pip install lytest simphony sax jax sklearn klayout devsim
pip install "jaxlib[cuda111]" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver
pip install gdsfactory==5.53.0
gf tool install
cd ..
set GF_PATH=%cd%

if exist "%USERPROFILE%\Desktop\gdsfactory" (goto SKIP_INSTALL)
cd %USERPROFILE%\Desktop
git clone https://github.com/gdsfactory/gdsfactory.git

cd gdsfactory
copy C:\Users\12269\Documents\GitHub\gdsfactory_SC\shortcuts.py .
%GF_PATH%\python shortcuts.py %GF_PATH%

:SKIP_INSTALL
echo gdsfactory installed
73 changes: 73 additions & 0 deletions shortcuts.py
@@ -0,0 +1,73 @@
import json
import sys

import menuinst


spyder_settings = """
{
"menu_name": "gdsfactory Spyder",
"menu_items":
[
{
"script": "${PREFIX}/Scripts/spyder.exe",
"scriptarguments": [],
"name": "gdsfactory Spyder",
"workdir": "${PREFIX}",
"icon": "${MENU_DIR}/spyder.ico",
"desktop": true,
"quicklaunch": true
}
]
}
"""


jupyter_lab_settings = """
{
"menu_name": "gdsfactory JupyterLab",
"menu_items":
[
{
"script": "${PREFIX}/Scripts/jupyter-lab.exe",
"scriptarguments": [],
"name": "gdsfactory JupyterLab",
"workdir": "${PREFIX}",
"icon": "${PREFIX}/Lib/site-packages/nbclassic/static/base/images/favicon.ico",
"desktop": true,
"quicklaunch": true
}
]
}
"""


anaconda_navigator_settings = """
{
"menu_name": "gdsfactory Anaconda Navigator",
"menu_items":
[
{
"script": "${PREFIX}/Scripts/anaconda-navigator.exe",
"scriptarguments": [],
"name": "gdsfactory Anaconda Navigator",
"workdir": "${PREFIX}",
"icon": "${MENU_DIR}/anaconda-navigator.ico",
"desktop": true,
"quicklaunch": true
}
]
}
"""


def shortcuts(settings: str):
with open(f"{sys.argv[1]}/settings.json", "w") as f:
json.dump(json.loads(settings), f)
menuinst.install(f"{sys.argv[1]}/settings.json", prefix=f"{sys.argv[1]}")


if __name__ == "__main__":
icons = [spyder_settings, jupyter_lab_settings, anaconda_navigator_settings]
for icon in icons:
shortcuts(icon)