diff options
author | John W. Parent <45471568+johnwparent@users.noreply.github.com> | 2021-07-07 08:32:47 -0400 |
---|---|---|
committer | Peter Scheibel <scheibel1@llnl.gov> | 2022-03-17 09:01:01 -0700 |
commit | e65d3d14b4a7a9a9667b006bea1f9f2eafc69472 (patch) | |
tree | f1a68cf906847887b44b9fe9afcf4cfc618d4a87 | |
parent | 4a73bfc3b9c4507f270951757475e514cd666ead (diff) | |
download | spack-e65d3d14b4a7a9a9667b006bea1f9f2eafc69472.tar.gz spack-e65d3d14b4a7a9a9667b006bea1f9f2eafc69472.tar.bz2 spack-e65d3d14b4a7a9a9667b006bea1f9f2eafc69472.tar.xz spack-e65d3d14b4a7a9a9667b006bea1f9f2eafc69472.zip |
Relocate spack_cmd and scripts from installer to root bin (#24651)
Relocate spack_cmd and scripts from installer
to root bin
Refactor documentation, installer, and launcher
to facilitate that change
-rw-r--r-- | bin/haspywin.py (renamed from lib/spack/spack/cmd/installer/scripts/haspywin.py) | 0 | ||||
-rw-r--r-- | bin/spack.bat (renamed from lib/spack/spack/cmd/installer/scripts/spack.bat) | 0 | ||||
-rw-r--r-- | bin/spack_cmd.bat (renamed from lib/spack/spack/cmd/installer/spack_cmd.bat) | 24 | ||||
-rw-r--r-- | lib/spack/docs/getting_started.rst | 38 | ||||
-rw-r--r-- | lib/spack/spack/cmd/installer/CMakeLists.txt | 6 | ||||
-rw-r--r-- | lib/spack/spack/cmd/installer/spack.wxs.in | 76 |
6 files changed, 63 insertions, 81 deletions
diff --git a/lib/spack/spack/cmd/installer/scripts/haspywin.py b/bin/haspywin.py index ea08e74d41..ea08e74d41 100644 --- a/lib/spack/spack/cmd/installer/scripts/haspywin.py +++ b/bin/haspywin.py diff --git a/lib/spack/spack/cmd/installer/scripts/spack.bat b/bin/spack.bat index 3b6b7905a4..3b6b7905a4 100644 --- a/lib/spack/spack/cmd/installer/scripts/spack.bat +++ b/bin/spack.bat diff --git a/lib/spack/spack/cmd/installer/spack_cmd.bat b/bin/spack_cmd.bat index a6eede3441..6d851d5311 100644 --- a/lib/spack/spack/cmd/installer/spack_cmd.bat +++ b/bin/spack_cmd.bat @@ -1,16 +1,18 @@ @ECHO OFF setlocal EnableDelayedExpansion :: (c) 2021 Lawrence Livermore National Laboratory -:: To use this file independently of Spack's installer, please copy this file, and the -:: 'scripts' directory, to be adjacent to your spack directory. You must have python on -:: your path for Spack to locate it. -:: source_dir -------- spack -:: |--- scripts -:: |--- spack_cmd.bat -pushd %~dp0 +:: To use this file independently of Spack's installer, execute this script in its directory, or add the +:: associated bin directory to your PATH. Invoke to launch Spack Shell. +:: +:: source_dir/spack/bin/spack_cmd.bat +:: +pushd %~dp0.. +set SPACK_ROOT=%CD% +pushd %CD%\.. set spackinstdir=%CD% popd + :: Check if Python is on the PATH (for /f "delims=" %%F in ('where python.exe') do (set python_pf_ver=%%F) ) 2> NUL @@ -38,17 +40,13 @@ if not defined python_pf_ver ( ) :exitpoint - -for /f "tokens=*" %%g in ('dir /b /a:d "%spackinstdir%\spack*"') do (set spack_ver=%%g) -set "SPACK_ROOT=%spackinstdir%\%spack_ver%" - -set "PATH=%spackinstdir%\scripts\;%PATH%" +set "PATH=%SPACK_ROOT%\bin\;%PATH%" if defined py_path ( set "PATH=%py_path%;%PATH%" ) if defined py_exe ( - "%py_exe%" "%spackinstdir%\scripts\haspywin.py" + "%py_exe%" "%SPACK_ROOT%\bin\haspywin.py" "%py_exe%" "%SPACK_ROOT%\bin\spack" external find python >NUL ) diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst index 3022c27dba..a904f0416a 100644 --- a/lib/spack/docs/getting_started.rst +++ b/lib/spack/docs/getting_started.rst @@ -1616,44 +1616,26 @@ Step 2: Install and setup Spack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We are now ready to get the Spack environment set up on our machine. We -begin by creating a top-level directory to do our work in: we will call -it ``spack_install`` in this tutorial. Inside this directory, use Git to -clone the Spack repo, hosted at https://github.com/spack/spack.git. +begin by using Git to clone the Spack repo, hosted at https://github.com/spack/spack.git +into a desired directory, for our purposes today, called ``spack_install``. The files and scripts used for Windows installation are on the ``features/windows-support`` branch; ``cd`` into the repo and use -``git checkout`` to switch to it. Then navigate to -``lib\spack\spack\cmd\installer`` and copy the ``scripts`` directory and -``spack_cmd.bat`` up to the top-level ``spack_install`` directory. In a -Windows console, you can do both of these things by executing the following -commands from the ``spack_install`` level: +``git checkout`` to switch to it. -.. code-block:: console - - xcopy lib\spack\spack\cmd\installer\scripts\ scripts\ - xcopy lib\spack\spack\cmd\installer\spack_cmd.bat . - -Your file structure should look like this after following the above -steps: - -.. code-block:: console - - spack_install - |--------spack - |--------scripts - |--------spack_cmd.bat ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Step 3: Run and configure Spack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -To use Spack, run ``spack_cmd.bat`` (you may need to Run as Administrator). -This will provide a Windows command prompt with an environment properly set -up with Spack and its prerequisites. If you receive a warning message that -Python is not in your ``PATH`` (which may happen if you installed Python -from the website and not the Windows Store), add the location of the Python -executable to your ``PATH`` now. +To use Spack, run ``bin\spack_cmd.bat`` (you may need to Run as Administrator) +from the spack source tree root. This will provide a Windows command prompt +with an environment properly set up with Spack and its prerequisites. +If you receive a warning message that Python is not in your ``PATH`` +(which may happen if you installed Python from the website and not +the Windows Store), add the location of the Python executable to your +``PATH`` now. To configure Spack, first run the following command inside the Spack console: diff --git a/lib/spack/spack/cmd/installer/CMakeLists.txt b/lib/spack/spack/cmd/installer/CMakeLists.txt index fe418cf337..efa9f2b6df 100644 --- a/lib/spack/spack/cmd/installer/CMakeLists.txt +++ b/lib/spack/spack/cmd/installer/CMakeLists.txt @@ -85,8 +85,6 @@ install(DIRECTORY "${SPACK_SOURCE}/" DESTINATION "${SPACK_DIR}") install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python-${PYTHON_VERSION}-win64/" DESTINATION "${PYTHON_DIR}") -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/scripts/" DESTINATION "scripts") -#install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/spack_cmd.bat/" DESTINATION ".") # CPACK Installer Instructions set(CPACK_PACKAGE_NAME "Spack") @@ -100,6 +98,7 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.rtf") #set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/NOTICE") # WIX options (the default) + set(CPACK_GENERATOR "WIX") set(CPACK_WIX_PRODUCT_ICON "${SPACK_LOGO}") set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/banner493x58.bmp") @@ -107,8 +106,9 @@ set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml") set(CPACK_WIX_UPGRADE_GUID "D2C703E4-721D-44EC-8016-BCB96BB64E0B") set(CPACK_WIX_SKIP_PROGRAM_FOLDER TRUE) +set(SHORTCUT_GUID "099213BC-0D37-4F29-B758-60CA2A7E6DDA") # Set full path to icon, shortcut in spack.wxs -set(SPACK_SHORTCUT "${CMAKE_CURRENT_SOURCE_DIR}/spack_cmd.bat") +set(SPACK_SHORTCUT "spack_cmd.bat") configure_file("spack.wxs.in" "${CMAKE_CURRENT_BINARY_DIR}/spack.wxs") configure_file("bundle.wxs.in" "${CMAKE_CURRENT_BINARY_DIR}/bundle.wxs") set(CPACK_WIX_EXTRA_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/spack.wxs") diff --git a/lib/spack/spack/cmd/installer/spack.wxs.in b/lib/spack/spack/cmd/installer/spack.wxs.in index c73bd27326..d8c2a15ada 100644 --- a/lib/spack/spack/cmd/installer/spack.wxs.in +++ b/lib/spack/spack/cmd/installer/spack.wxs.in @@ -1,48 +1,50 @@ <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> - <DirectoryRef Id="TARGETDIR"> - <Directory Id="DesktopFolder" Name="Desktop" /> - <Directory Id="ProgramMenuFolder" Name="Programs"> - <Directory Id="ApplicationProgramsFolder" Name="Spack"> - <Component Id="ProgramMenuDir" Guid="*"> - <RemoveFolder Id="ProgramMenuDir" On="uninstall"/> - <RegistryValue Root="HKMU" Key="Software\LLNL\Spack" - Type="integer" Value="1" Name="installed" KeyPath="yes" /> - </Component> - </Directory> - </Directory> - </DirectoryRef> -</Fragment> -<Fragment> <Icon Id="icon.ico" SourceFile="@CPACK_WIX_PRODUCT_ICON@"/> <Property Id="ARPPRODUCTICON" Value="icon.ico" /> </Fragment> <Fragment> - <!-- Add the shortcut to installer package --> - <ComponentGroup Id="ProductComponents" Directory="INSTALL_ROOT"> - <Component Id="ApplicationShortcut" Guid="@CPACK_WIX_UPGRADE_GUID@"> - <File Source="@SPACK_SHORTCUT@" KeyPath="yes"> - <Shortcut Id="SpackStartMenuShortcut" - Directory="DesktopFolder" - Advertise="yes" - Name="Spack Package Manager" - Description="Spack package manager" - WorkingDirectory="INSTALL_ROOT" - Icon="icon1.ico"> + <DirectoryRef Id="TARGETDIR"> + <Directory Id="DesktopFolder" Name="Desktop" > + <Component Id="SpackDesktopShortCut" Guid="@CPACK_WIX_UPGRADE_GUID@"> + <Shortcut Id="SpackDesktopShortCut" + Name="Spack Package Manager" + Description="Spack package manager" + Target="[INSTALL_ROOT]/@SPACK_DIR@/bin/@SPACK_SHORTCUT@" + Icon="icon1.ico"> <Icon Id="icon1.ico" SourceFile="@CPACK_WIX_PRODUCT_ICON@" /> </Shortcut> - <Shortcut Id="startMenuShotcut" - Directory="ApplicationProgramsFolder" - Name="Spack Package Manager" - WorkingDirectory="INSTALL_ROOT" - Icon="icon2.ico" - IconIndex="0" - Advertise="yes"> - <Icon Id="icon2.ico" SourceFile="@CPACK_WIX_PRODUCT_ICON@" /> - </Shortcut> - </File> - </Component> + <RegistryValue Root="HKCU" Key="Software\LLNL\Spack" + Type="integer" Value="1" Name="SpackDesktopShortCut" KeyPath="yes" /> + </Component> + </Directory> + <Directory Id="ProgramMenuFolder" Name="Programs"> + <Directory Id="ApplicationProgramsFolder" Name="Spack"> + <Component Id="SpackStartShortCut" Guid="@SHORTCUT_GUID@"> + <Shortcut Id="SpackStartMenuShortCut" + Name="Spack Package Manager" + Description="Spack package manager" + Target="[INSTALL_ROOT]/@SPACK_DIR@/bin/@SPACK_SHORTCUT@" + Icon="icon2.ico"> + <Icon Id="icon2.ico" SourceFile="@CPACK_WIX_PRODUCT_ICON@" /> + </Shortcut> + <RegistryValue Root="HKCU" Key="Software/LLNL/Spack" + Type="integer" Value="1" Name="SpackStartMenuShortCut" KeyPath="yes" /> + </Component> + <Component Id="ProgramMenuDir" Guid="*"> + <RemoveFolder Id="ProgramMenuDir" On="uninstall"/> + <RegistryValue Root="HKMU" Key="Software\LLNL\Spack" + Type="integer" Value="1" Name="installed" KeyPath="yes" /> + </Component> + </Directory> + </Directory> + </DirectoryRef> +</Fragment> +<Fragment> + <ComponentGroup Id="ProductComponents"> + <ComponentRef Id="SpackStartShortCut"/> + <ComponentRef Id="SpackDesktopShortCut"/> </ComponentGroup> </Fragment> -</Wix>
\ No newline at end of file +</Wix> |