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

[FEATURE] MacOS support #95

Closed
mdubinko opened this issue Feb 27, 2021 · 12 comments
Closed

[FEATURE] MacOS support #95

mdubinko opened this issue Feb 27, 2021 · 12 comments
Assignees
Labels
enhancement ⬆️ Implements a new feature, fixes or improves existing ones
Milestone

Comments

@mdubinko
Copy link

mdubinko commented Feb 27, 2021

There is an old version of archey still on Mac Homebrew, but it's listed as deprecated and brew doctor suggests finding an alternative. Posting here in case someone has already considered adding MacOS (Darwin, actually) support to this nice project.

In this particular instance, I'm still on Catalina 10.15.7 :

python3 -m distro -j
{
    "codename": "",
    "id": "darwin",
    "like": "",
    "version": "19.6.0",
    "version_parts": {
        "build_number": "0",
        "major": "19",
        "minor": "6"
    }
}
@HorlogeSkynet
Copy link
Owner

HorlogeSkynet commented Feb 28, 2021

Hi @mdubinko, thanks for properly opening this up.

From this formula, I understood Homebrew's proposed Archey version corresponds to this project.
I'd love seeing Archey 4 supporting macOS (maybe related to #69 too ?), I unfortunately don't have a proper setup to experiment those developments, and didn't want to abuse of Microsoft GitHub's CI in such conditions.

That being said, have you tried directly running a recent release of Archey 4 on your system ? Despite a wrong logo being displayed, I'd want to know whether it crashed, and if so, why !

Bye 👋


EDIT : Also see related #38.

@HorlogeSkynet HorlogeSkynet self-assigned this Feb 28, 2021
@HorlogeSkynet HorlogeSkynet added enhancement ⬆️ Implements a new feature, fixes or improves existing ones help wanted 🆘 This issue needs someone else ! Maybe you ? labels Feb 28, 2021
@HorlogeSkynet HorlogeSkynet added this to TO DO in OS, Distributions & Hardware via automation Feb 28, 2021
@HorlogeSkynet HorlogeSkynet added this to the v4.11.0 milestone Mar 2, 2021
@mdubinko
Copy link
Author

mdubinko commented Mar 3, 2021

Straight out of the box, I get
...
File "/usr/local/lib/python3.9/site-packages/archey/entries/cpu.py", line 48, in init
self.value = self._parse_lscpu_output()
File "/usr/local/lib/python3.9/site-packages/archey/entries/cpu.py", line 83, in _parse_lscpu_output
cpu_info = check_output('lscpu', env={'LANG': 'C'}, universal_newlines=True)
...
File "/usr/local/Cellar/python@3.9/3.9.2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1823, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'lscpu'

Alas, MacOS has neither /proc nor an lscpu binary. According to https://www.quora.com/Is-there-a-Mac-OS-equivalent-to-the-Linux-lscpu it looks like the near equivalent is

sysctl -n machdep.cpu.brand_string

Which locally returns

Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz

So it seems like it would be more complicated to figure out cores/threads/etc. Would it be worth looking at how archey-osx does it, or would you prefer more of a cleanroom approach?

@HorlogeSkynet
Copy link
Owner

Thanks for you feedback, I'm actually already on it with the help of a friend. Expect a proper proposition within some days. Bye 🙇

HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
> This patch imitates Neofetch and Screenfetch behaviors, as "Aqua" does not explicitly appear in processes list.

> See related : #95.
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
... and "title-ifies" the ones already present for consistency purposes

> See related : #95.
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
HorlogeSkynet pushed a commit that referenced this issue Mar 9, 2021
@HorlogeSkynet
Copy link
Owner

HorlogeSkynet commented Mar 9, 2021

Hey back @mdubinko. Would you be able to test latest develop state (recently force-pushed, care with your fork) ?

git checkout develop
git pull
python3 -m archey

I had to adapt tests a bit, but now CI is all green.

I'm waiting for your feedback before anything else.


EDIT : Most of Archey-OSX has been ported, and (regular) BSDs should be supported too.


Bye 👋

@HorlogeSkynet HorlogeSkynet moved this from TO DO to IN PROGRESS in OS, Distributions & Hardware Mar 9, 2021
@mdubinko
Copy link
Author

mdubinko commented Mar 9, 2021

My fork is basically abandoned at this point. :) I ran this straight from the develop branch on this repo.

 % python3 -m archey                                                                                                          (develop)archey4
WARNING: [sysctl]: Couldn't fetch temperature from CPU sensors (sysctl: unknown oid 'dev.cpu.0.temperature'). Please be sure to load the corresponding kernel driver beforehand (`kldload coretemp` for Intel or `kldload amdtemp` for AMD`).
                                  User: micah
                     'c.          Hostname: retina15.lan
                  ,xNMM.          Model: MacBookPro11.3
                .OMMMMo           Distro: Darwin 19.6.0 [x86_64]
                OMMM0,            Kernel: 19.6.0
      .;loddo:' loolloddol;.      Uptime: 7 days, 11 hours and 46 minutes
    cKMMMMMMMMMMNWMMMMMMMMMM0:    Processes: 584
  .KMMMMMMMMMMMMMMMMMMMMMMMWd.    WindowManager: Quartz Compositor
  XMMMMMMMMMMMMMMMMMMMMMMMX.      DesktopEnvironment: Aqua
  MMMMMMMMMMMMMMMMMMMMMMMM:       Shell: /bin/zsh
  MMMMMMMMMMMMMMMMMMMMMMMM:       Terminal: iTerm.app ██ ██ ██ ██ ██ ██ ██
  MMMMMMMMMMMMMMMMMMMMMMMMX.      Packages: 131
  kMMMMMMMMMMMMMMMMMMMMMMMMWd.    Temperature: Not detected
  .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   CPU: 8 x Quad-Core Intel Core i7 @ 2.3 GHz
   .XMMMMMMMMMMMMMMMMMMMMMMMMK.   GPU: Intel Iris Pro
     kMMMMMMMMMMMMMMMMMMMMMMd     GPU: NVIDIA GeForce GT 750M
      ;KMMMMMMMWXXWMMMMMMMk.      RAM: 1664 MiB / 16384 MiB
        .cooc,.    .,coo:.        Disk: 4.5 TiB / 10.6 TiB
                                  LanIP: fe80::1, 192.168.86.27
                                  WanIP: (redacted) 😄 

After iTerm.app the rectangular blocks are in fact color swatches.
Not sure if intended, but the "Disk" figure includes my network mounted backup drive.

@HorlogeSkynet
Copy link
Owner

HorlogeSkynet commented Mar 10, 2021

My fork is basically abandoned at this point. :)

It was just in case 😌

Not sure if intended, but the "Disk" figure includes my network mounted backup drive.

Since #67 (IIRC), Disk process them all, indeed.
2 possibilities :

  • if you got a regular setup, we may blacklist your mount point from computations (we would need the df -h entry corresponding to your network drive) ;
  • if not (e.g. manually mounted under a local path), you may select specific disks (or even mount points) as configuration (check out show_filesystems option key). You may also split Disk in separate entries (combine_total option key).

One more thing I also spotted in CI executions : I can't understand your Distro entry output. Could you run python3 -c 'import platform; print(platform.mac_ver())' for me please ?


Thanks for your feedback ! Bye 👋


EDIT : I don't know whether the sysctl warning is relevant to write on macOS, do you have an idea about this ?

@mdubinko
Copy link
Author

On my Catalina box: ('10.15.7', ('', '', ''), 'x86_64')
On my Big Sur box: ('10.16', ('', '', ''), 'x86_64')

Not sure how temp sensors work across different Macs, and I haven't closely inspected the new code yet. Though that error message mentions AMD and probably isn't even relevant for Mac...

@HorlogeSkynet
Copy link
Owner

HorlogeSkynet commented Mar 10, 2021

Thanks again, please find an updated develop (supposed to be) fixing those last two issues. 👋


EDIT : I opted for (apparently well-known) third-parties to gather temperature on macOS (iStats or OSX CPU Temp), without any error messages in case they are not installed so as to keep the detection fully-optional and a "clean" output out-of-the-box for iUsers. What do you think about that ?

@HorlogeSkynet HorlogeSkynet removed the help wanted 🆘 This issue needs someone else ! Maybe you ? label Mar 10, 2021
@HorlogeSkynet
Copy link
Owner

All good on my side, I'm waiting for your feedback about last develop changes before merging this on master and drafting a v4.11.0 👌 Cheers

@mdubinko
Copy link
Author

mdubinko commented Mar 19, 2021

# python3 -m archey

Gave good output with no error messages. Temperature: Not detected

I ran # brew install osx-cpu-temp then tried again, and got:

...
  File "/Users/micah/Developer/archey4/archey/__main__.py", line 137, in _entry_instantiator
    return Entries[entry.pop('type')].value(
  File "/Users/micah/Developer/archey4/archey/entries/temperature.py", line 37, in __init__
    self._run_istats_or_osxcputemp()
  File "/Users/micah/Developer/archey4/archey/entries/temperature.py", line 140, in _run_istats_or_osxcputemp
    self._temps.append(float(osxcputemp_output.split()[0]))
ValueError: could not convert string to float: '57.0°C'

@HorlogeSkynet
Copy link
Owner

Thanks again for your feedback @mdubinko !
It appears lavoiesl/osx-cpu-temp#22 has not been released yet, so I got kidded by the upstream documentation. Anyway, I've just published a fix and will try to release a new version this WE. Bye 👋

@HorlogeSkynet
Copy link
Owner

Released today as v4.11.0, waiting for feedback from the community now. Bye 👋

OS, Distributions & Hardware automation moved this from IN PROGRESS to DONE Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ⬆️ Implements a new feature, fixes or improves existing ones
Development

No branches or pull requests

2 participants