summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/getting_started.rst38
-rw-r--r--lib/spack/spack/cmd/installer/CMakeLists.txt6
-rw-r--r--lib/spack/spack/cmd/installer/scripts/haspywin.py20
-rw-r--r--lib/spack/spack/cmd/installer/scripts/spack.bat223
-rw-r--r--lib/spack/spack/cmd/installer/spack.wxs.in76
-rw-r--r--lib/spack/spack/cmd/installer/spack_cmd.bat63
6 files changed, 52 insertions, 374 deletions
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/scripts/haspywin.py b/lib/spack/spack/cmd/installer/scripts/haspywin.py
deleted file mode 100644
index ea08e74d41..0000000000
--- a/lib/spack/spack/cmd/installer/scripts/haspywin.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
-# Spack Project Developers. See the top-level COPYRIGHT file for details.
-#
-# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import subprocess
-import sys
-
-
-def getpywin():
- try:
- import win32con # noqa
- except ImportError:
- subprocess.check_call(
- [sys.executable, "-m", "pip", "-q", "install", "--upgrade", "pip"])
- subprocess.check_call(
- [sys.executable, "-m", "pip", "-q", "install", "pywin32"])
-
-
-if __name__ == '__main__':
- getpywin()
diff --git a/lib/spack/spack/cmd/installer/scripts/spack.bat b/lib/spack/spack/cmd/installer/scripts/spack.bat
deleted file mode 100644
index 3b6b7905a4..0000000000
--- a/lib/spack/spack/cmd/installer/scripts/spack.bat
+++ /dev/null
@@ -1,223 +0,0 @@
-:: Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
-:: Spack Project Developers. See the top-level COPYRIGHT file for details.
-::
-:: SPDX-License-Identifier: (Apache-2.0 OR MIT)
-::#######################################################################
-::
-:: This file is part of Spack and sets up the spack environment for batch,
-:: This includes environment modules and lmod support,
-:: and it also puts spack in your path. The script also checks that at least
-:: module support exists, and provides suggestions if it doesn't. Source
-:: it like this:
-::
-:: . /path/to/spack/install/spack_cmd.bat
-::
-@echo off
-
-set spack=%SPACK_ROOT%\bin\spack
-
-::#######################################################################
-:: This is a wrapper around the spack command that forwards calls to
-:: 'spack load' and 'spack unload' to shell functions. This in turn
-:: allows them to be used to invoke environment modules functions.
-::
-:: 'spack load' is smarter than just 'load' because it converts its
-:: arguments into a unique Spack spec that is then passed to module
-:: commands. This allows the user to use packages without knowing all
-:: their installation details.
-::
-:: e.g., rather than requiring a full spec for libelf, the user can type:
-::
-:: spack load libelf
-::
-:: This will first find the available libelf module file and use a
-:: matching one. If there are two versions of libelf, the user would
-:: need to be more specific, e.g.:
-::
-:: spack load libelf@0.8.13
-::
-:: This is very similar to how regular spack commands work and it
-:: avoids the need to come up with a user-friendly naming scheme for
-:: spack module files.
-::#######################################################################
-
-:_sp_shell_wrapper
-set "_sp_flags="
-set "_sp_args="
-set "_sp_subcommand="
-setlocal enabledelayedexpansion
-:: commands have the form '[flags] [subcommand] [args]'
-:: flags will always start with '-', e.g. --help or -V
-:: subcommands will never start with '-'
-:: everything after the subcommand is an arg
-for %%x in (%*) do (
- set t="%%~x"
- if "!t:~0,1!" == "-" (
- if defined _sp_subcommand (
- :: We already have a subcommand, processing args now
- set "_sp_args=!_sp_args! !t!"
- ) else (
- set "_sp_flags=!_sp_flags! !t!"
- shift
- )
- ) else if not defined _sp_subcommand (
- set "_sp_subcommand=!t!"
- shift
- ) else (
- set "_sp_args=!_sp_args! !t!"
- shift
- )
-)
-
-:: --help, -h and -V flags don't require further output parsing.
-:: If we encounter, execute and exit
-if defined _sp_flags (
- if NOT "%_sp_flags%"=="%_sp_flags:-h=%" (
- python "%spack%" %_sp_flags%
- exit /B 0
- ) else if NOT "%_sp_flags%"=="%_sp_flags:--help=%" (
- python "%spack%" %_sp_flags%
- exit /B 0
- ) else if NOT "%_sp_flags%"=="%_sp_flags:-V=%" (
- python "%spack%" %_sp_flags%
- exit /B 0
- )
-)
-:: pass parsed variables outside of local scope. Need to do
-:: this because delayedexpansion can only be set by setlocal
-echo %_sp_flags%>flags
-echo %_sp_args%>args
-echo %_sp_subcommand%>subcmd
-endlocal
-set /p _sp_subcommand=<subcmd
-set /p _sp_flags=<flags
-set /p _sp_args=<args
-set str_subcommand=%_sp_subcommand:"='%
-set str_flags=%_sp_flags:"='%
-set str_args=%_sp_args:"='%
-if "%str_subcommand%"=="ECHO is off." (set "_sp_subcommand=")
-if "%str_flags%"=="ECHO is off." (set "_sp_flags=")
-if "%str_args%"=="ECHO is off." (set "_sp_args=")
-del subcmd
-del flags
-del args
-
-:: Filter out some commands. For any others, just run the command.
-if "%_sp_subcommand%" == "cd" (
- goto :case_cd
-) else if "%_sp_subcommand%" == "env" (
- goto :case_env
-) else if "%_sp_subcommand%" == "load" (
- goto :case_load
-) else if "%_sp_subcommand%" == "unload" (
- goto :case_load
-) else (
- goto :default_case
-)
-
-::#######################################################################
-
-:case_cd
-:: Check for --help or -h
-:: TODO: This is not exactly the same as setup-env.
-:: In setup-env, '--help' or '-h' must follow the cd
-:: Here, they may be anywhere in the args
-if defined _sp_args (
- if NOT "%_sp_args%"=="%_sp_args:--help=%" (
- python "%spack%" cd -h
- goto :end_switch
- ) else if NOT "%_sp_args%"=="%_sp_args:-h=%" (
- python "%spack%" cd -h
- goto :end_switch
- )
-)
-
-for /F "tokens=* USEBACKQ" %%F in (
- `python "%spack%" location %_sp_args%`) do (
- set "LOC=%%F"
-)
-for %%Z in ("%LOC%") do if EXIST %%~sZ\NUL (cd /d "%LOC%")
-goto :end_switch
-
-:case_env
-:: If no args or args contain --bat or -h/--help: just execute.
-if NOT defined _sp_args (
- goto :default_case
-)else if NOT "%_sp_args%"=="%_sp_args:--help=%" (
- goto :default_case
-) else if NOT "%_sp_args%"=="%_sp_args: -h=%" (
- goto :default_case
-) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" (
- goto :default_case
-) else if NOT "%_sp_args%"=="%_sp_args:deactivate=%" (
- for /f "tokens=* USEBACKQ" %%I in (
- `call python "%spack%" %_sp_flags% env deactivate --bat %_sp_args:deactivate=%`
- ) do %%I
-) else if NOT "%_sp_args%"=="%_sp_args:activate=%" (
- for /f "tokens=* USEBACKQ" %%I in (
- `call python "%spack%" %_sp_flags% env activate --bat %_sp_args:activate=%`
- ) do %%I
-) else (
- goto :default_case
-)
-goto :end_switch
-
-:case_load
-:: If args contain --sh, --csh, or -h/--help: just execute.
-if defined _sp_args (
- if NOT "%_sp_args%"=="%_sp_args:--help=%" (
- goto :default_case
- ) else if NOT "%_sp_args%"=="%_sp_args: -h=%" (
- goto :default_case
- ) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" (
- goto :default_case
- )
-)
-
-for /f "tokens=* USEBACKQ" %%I in (
- `python "%spack%" %_sp_flags% %_sp_subcommand% --bat %_sp_args%`) do %%I
-)
-goto :end_switch
-
-:case_unload
-goto :case_load
-
-:default_case
-python "%spack%" %_sp_flags% %_sp_subcommand% %_sp_args%
-goto :end_switch
-
-:end_switch
-exit /B 0
-
-
-::########################################################################
-:: Prepends directories to path, if they exist.
-:: pathadd /path/to/dir # add to PATH
-:: or pathadd OTHERPATH /path/to/dir # add to OTHERPATH
-::########################################################################
-
-:_spack_pathadd
-set "_pa_varname=PATH"
-set "_pa_new_path=%~1"
-if NOT "%~2" == "" (
- set "_pa_varname=%~1"
- set "_pa_new_path=%~2"
- )
-set "_pa_oldvalue=%_pa_varname%"
-for %%Z in ("%_pa_new_path%") do if EXIST %%~sZ\NUL (
- if defined %_pa_oldvalue% (
- set "_pa_varname=%_pa_new_path%:%_pa_oldvalue%"
- ) else (
- set "_pa_varname=%_pa_new_path%"
- )
-)
-exit /b 0
-
-:: set module system roots
-:_sp_multi_pathadd
-for %%I in (%~2) do (
- for %%Z in (%_sp_compatible_sys_types%) do (
- :pathadd "%~1" "%%I\%%Z"
- )
-)
-exit /B 0 \ No newline at end of file
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>
diff --git a/lib/spack/spack/cmd/installer/spack_cmd.bat b/lib/spack/spack/cmd/installer/spack_cmd.bat
deleted file mode 100644
index a6eede3441..0000000000
--- a/lib/spack/spack/cmd/installer/spack_cmd.bat
+++ /dev/null
@@ -1,63 +0,0 @@
-@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
-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
-
-if not defined python_pf_ver (
- :: If not, look for Python from the Spack installer
- :get_builtin
- (for /f "tokens=*" %%g in ('dir /b /a:d "!spackinstdir!\Python*"') do (
- set python_ver=%%g)) 2> NUL
-
- if not defined python_ver (
- echo Python was not found on your system.
- echo Please install Python or add Python to your PATH.
- ) else (
- set py_path=!spackinstdir!\!python_ver!
- set py_exe=!py_path!\python.exe
- )
- goto :exitpoint
-) else (
- :: Python is already on the path
- set py_exe=!python_pf_ver!
- (for /F "tokens=* USEBACKQ" %%F in (
- `!py_exe! --version`) do (set "output=%%F")) 2>NUL
- if not "!output:Microsoft Store=!"=="!output!" goto :get_builtin
- goto :exitpoint
-)
-: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%"
-if defined py_path (
- set "PATH=%py_path%;%PATH%"
-)
-
-if defined py_exe (
- "%py_exe%" "%spackinstdir%\scripts\haspywin.py"
- "%py_exe%" "%SPACK_ROOT%\bin\spack" external find python >NUL
-)
-
-set "EDITOR=notepad"
-
-DOSKEY spacktivate=spack env activate $*
-
-@echo **********************************************************************
-@echo ** Spack Package Manager
-@echo **********************************************************************
-
-%comspec% /k