milahu / nixpkgs

Nix Packages collection
MIT License
1 stars 0 forks source link

gitfs: AttributeError: module 'collections' has no attribute 'MutableMapping' #52

Open milahu opened 4 months ago

milahu commented 4 months ago
$ gitfs --help
Traceback (most recent call last):
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/bin/.gitfs-wrapped", line 9, in <module>
    sys.exit(mount())
             ^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/__init__.py", line 19, in mount
    from gitfs.mounter import start_fuse
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/mounter.py", line 25, in <module>
    from gitfs.utils import Args
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/utils/__init__.py", line 16, in <module>
    from .args import Args
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/utils/args.py", line 30, in <module>
    from gitfs.cache import lru_cache
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/cache/__init__.py", line 16, in <module>
    from .lru import LRUCache
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/cache/lru.py", line 22, in <module>
    from .base import Cache
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/cache/base.py", line 18, in <module>
    class Cache(collections.MutableMapping):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'

fixed by

--- /a/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/cache/base.py  1970-01-01 01:00:01.000000000 +0100
+++ /b/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/cache/base.py  2024-05-08 18:10:55.318883086 +0200
@@ -14,8 +14,12 @@

 import collections

+try:
+    from collections.abc import MutableMapping
+except ImportError:
+    from collections import MutableMapping

-class Cache(collections.MutableMapping):
+class Cache(MutableMapping):
     """Mutable mapping to serve as a simple cache or cache base class.

     This class discards arbitrary items using :meth:`popitem` to make
milahu commented 4 months ago

next error

$ gitfs https://github.com/milahu/random mnt
Traceback (most recent call last):
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/bin/.gitfs-wrapped", line 9, in <module>
    sys.exit(mount())
             ^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/__init__.py", line 21, in mount
    start_fuse()
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/mounter.py", line 124, in start_fuse
    args = parse_args(parser)
           ^^^^^^^^^^^^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/mounter.py", line 44, in parse_args
    return Args(parser)
           ^^^^^^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/utils/args.py", line 67, in __init__
    self.config = self.build_config(parser.parse_args())
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/utils/args.py", line 76, in build_config
    return self.check_args(self.set_defaults(args))
                           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/utils/args.py", line 154, in set_defaults
    value = value(args)
            ^^^^^^^^^^^
  File "/nix/store/8f0fyssl2ah5w34xqmxl2clpk0bjn8z6-gitfs-0.5.2/lib/python3.11/site-packages/gitfs/utils/args.py", line 185, in get_repo_path
    return tempfile.mkdtemp(dir="/var/lib/gitfs")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/tempfile.py", line 385, in mkdtemp
    _os.mkdir(file, 0o700)
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/gitfs/tmp4lse9rz9'

looks like nobody is using gitfs from nixpkgs