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

Mimesis fails on FreeBSD #1544

Closed
patmaddox opened this issue Apr 25, 2024 · 1 comment · Fixed by #1545
Closed

Mimesis fails on FreeBSD #1544

patmaddox opened this issue Apr 25, 2024 · 1 comment · Fixed by #1545

Comments

@patmaddox
Copy link
Contributor

Bug report

What's wrong

self = <mimesis.providers.path.Path object at 0x8634f1490>, platform = 'freebsd13', args = (), kwargs = {'seed': <mimesis.types._MissingSeed object at 0x845334b10>}

    def __init__(
        self,
        platform: str = sys.platform,
        *args: t.Any,
        **kwargs: t.Any,
    ) -> None:
        """Initialize attributes.
    
        Supported platforms: 'linux', 'darwin', 'win32', 'win64'.
    
        :param platform: Required platform type.
        """
        super().__init__(*args, **kwargs)
        self.platform = platform
        self._pathlib_home = PureWindowsPath() if "win" in platform else PurePosixPath()
>       self._pathlib_home /= PLATFORMS[platform]["home"]
E       KeyError: 'freebsd13'

mimesis/providers/path.py:37: KeyError

How is that should be

It works

System information

FreeBSD 13

@patmaddox patmaddox mentioned this issue Apr 25, 2024
3 tasks
@patmaddox
Copy link
Contributor Author

In #1545 I added explicit support for FreeBSD. Instead of this approach, I wonder if it would be worth defaulting to /home/ on POSIX systems, and have Windows be the one exceptional case? The only system-specific config is the home dir.

I don't have access to a windows machine for testing, so I don't know exactly what it would be, but something like:

if "win" in platform:
    self._pathlib_home = PureWindowsPath() / "C:\\Users\\"
else:
    self._pathlib_home = PurePosixPath / "/home/"

or perhaps it's even simpler:

self._pathlib_home = WindowsPath("C:\\Users\\") if "win" in platform else PosixPath("/home/")

That way it would work on any BSD, solaris, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant