Repository: spack/spack

Issue:
Installation issue: py-xdot
### Steps to reproduce the issue

```console
$ spack install py-xdot@1.0%gcc@10.2.0 arch=linux-opensuse_leap15-x86_64
```


### Error message

<details><summary>Error message</summary><pre>
==> py-xdot: Executing phase: 'install'
==> Error: FileNotFoundError: [Errno 2] No such file or directory: '/soft/spack-builds/linux-opensuse_leap15-x86_64/gcc-10.2.0/py-xdot-1.0-ewo6l45m7prdcqfibj6tgtbfh4imhsvo/lib64/python3.9/site-packages/xdot/__init__.py'

/soft/spack-install/var/spack/repos/builtin/packages/py-xdot/package.py:49, in post_install:
         46        print(dst)
         47        filter_file("import sys",
         48                    "import sys\nimport os\nos.environ['GI_TYPELIB_PATH']" +
      **49                    " = '%s'" % repo_paths, dst)**
         50        # regenerate the byte-compiled __init__.py
         51        python3 = spec['python'].command
         52        python3('-m', 'compileall', dst)
</pre></details>


### Information on your system

* **Spack:** 0.19.0.dev0 (7b95e2f05043442ee2d2c1494c5cef7b1a489251)
* **Python:** 3.6.15
* **Platform:** linux-opensuse_leap15-icelake
* **Concretizer:** clingo

### Additional information

@lee218llnl py-xdot seems to be installed to `lib/python3.9/site-packages` for SUSE system with host python.
I got around this issue by using `python_purelib` instead. Not certain if this is the appropriate fix.

```git
diff --git a/var/spack/repos/builtin/packages/py-xdot/package.py 
b/var/spack/repos/builtin/packages/py-xdot/package.py
index e7197bf731..846dfa7390 100644
--- a/var/spack/repos/builtin/packages/py-xdot/package.py
+++ b/var/spack/repos/builtin/packages/py-xdot/package.py
@@ -42,7 +42,7 @@ def post_install(self):
             join_path(spec['gdk-pixbuf'].prefix.lib, 'girepository-1.0'),
             join_path(spec['gtkplus'].prefix.lib, 'girepository-1.0'),
             join_path(spec['harfbuzz'].prefix.lib, 'girepository-1.0'))
-        dst = join_path(python_platlib, 'xdot', '__init__.py')
+        dst = join_path(python_purelib, 'xdot', '__init__.py')
         filter_file("import sys",
                     "import sys\nimport os\nos.environ['GI_TYPELIB_PATH']" +
                     " = '%s'" % repo_paths, dst)
```

@adamjstewart I also see py-wheel and py-setuptools installing to `lib` instead of `lib64` as well. These install fine.
However since py-xdot uses setuptools and wheels maybe that is the reason it is using `lib` instead of `lib64` for install location.

[spack-build-out.txt](https://github.com/spack/spack/files/9127227/spack-build-out.txt)
[spack-build-env.txt](https://github.com/spack/spack/files/9127228/spack-build-env.txt)

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Yes, that looks like the right fix, want to open a PR?

Setuptools installs to purelib for pure-Python packages and platlib for packages with non-Python components. On most systems, purelib and platlib are the same, but not on SUSE.
perhaps we should make sure this doesn't break backwards compatibility for older python versions and other OSs. If necessary, since we could append both the platlib and purlib paths, or put conditionals in there based on python versions.
This is unrelated to Python version or OS. This file should always be installed in purelib as long as the library has always been a pure-Python library. 
OK, that makes sense. Thanks.
@adamjstewart Sure, I can open a PR unless @lee218llnl would like to open it.
Go ahead, you found the solution. 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-xdot/package.py b/var/spack/repos/builtin/packages/py-xdot/package.py
--- a/var/spack/repos/builtin/packages/py-xdot/package.py
+++ b/var/spack/repos/builtin/packages/py-xdot/package.py
@@ -42,7 +42,7 @@ def post_install(self):
             join_path(spec['gdk-pixbuf'].prefix.lib, 'girepository-1.0'),
             join_path(spec['gtkplus'].prefix.lib, 'girepository-1.0'),
             join_path(spec['harfbuzz'].prefix.lib, 'girepository-1.0'))
-        dst = join_path(python_platlib, 'xdot', '__init__.py')
+        dst = join_path(python_purelib, 'xdot', '__init__.py')
         filter_file("import sys",
                     "import sys\nimport os\nos.environ['GI_TYPELIB_PATH']" +
                     " = '%s'" % repo_paths, dst)


Test patch: