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

Fix OSX Compatibility Issues (workarounds included) #63

Closed
frankamp opened this issue Jul 18, 2018 · 19 comments
Closed

Fix OSX Compatibility Issues (workarounds included) #63

frankamp opened this issue Jul 18, 2018 · 19 comments
Assignees
Labels
Milestone

Comments

@frankamp
Copy link

  • amazon-dash version:
    1.0.4
  • Python version:
    2.7.10
  • Operating System:
    OSX 10.13.4

Description

I tried to run this on OSX. It errors during the install step trying to determine whether I have systemd and during the run step trying to write an error message about the write permissions of the config file, because root is not a valid group.

What I Did

During install it bombs here:

return check_output(['ps', '--no-headers', '-o', 'comm', '1']).strip(b'\n ').decode('utf-8')

So I commented out line 99 in the init of the install path re:
#if get_init_system() != 'systemd' or not get_systemd_services_path(): which makes it just raise an exception raise IsInstallableException('Systemd is not available'). This is fine though, because that exception is still a successful installation path re: "You must run it manually". I'm just developing on this machine, I'll run everything manually.

Then I discovered my dash button mac, and wrote a config file.

When I ran it, it complained about being unable to read a group, which turns out to be in the error handling code. I don't think I care about file permissions at all, least of all write perms. Maybe this should just be a warning?

I commented out all the write permissions error code

#   if (not os.getuid() and not only_root_write(file)) or oth_w_perm(file):
        #     file = os.path.abspath(file)
        #     raise SecurityException(
        #         'There should be no permissions for other users in the file "{file}". '
        #         'Current permissions: {user}:{group} {perms}. {msg}. '
        #         'Run "sudo chmod 660 \'{file}\' && sudo chown root:root \'{file}\'"'.format(
        #             file=file, user=get_file_owner(file),
        #             group=get_file_group(file), perms=os.stat(file).st_mode & 0o777,
        #             msg='Removes write permission for others' if os.getuid()
        #             else 'Only root must be able to write to file'))

It works fine.

Thanks for the program yo.

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Amazon-dash has not been tested on OS X. The Amazon-dash installer does not support OSX. The installer is for Linux so you can ignore the installation step.

@frankamp
Copy link
Author

frankamp commented Jul 18, 2018

It has now and it works great! I made it turn on my spotify on my machine for fun. With a couple of tweaks and a bit of docs, it would be usable by a lot of devs.

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

In a next version I will make sure that there is no error in the installation process. Thank you.

Does it work in OS X then? Does the discovery command work for you?

@frankamp
Copy link
Author

Yep! I had a dash button make spotify play (using hnarayanan/shpotify cli project).

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Thank you :)

@Nekmo Nekmo self-assigned this Jul 18, 2018
@Nekmo Nekmo added the bug label Jul 18, 2018
@Nekmo Nekmo added this to the v1.1.0 milestone Jul 18, 2018
@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Can you please give me the exception traceback of this code in OSX?

(not os.getuid() and not only_root_write(file)) or oth_w_perm(file):

@frankamp
Copy link
Author

frankamp commented Jul 18, 2018 via email

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

OK thanks. I'm going to submit a patched version in the development branch. Please tell me if it works for you.

@frankamp
Copy link
Author

frankamp commented Jul 18, 2018 via email

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Please install It using:

pip install https://github.com/Nekmo/amazon-dash/archive/develop.zip

Remember to fix the permissions of the Amazon-dash configuration file:

chmod 660 amazon-dash.yml && chown root:root amazon-dash.yml

Thanks.

@frankamp
Copy link
Author

frankamp commented Jul 18, 2018 via email

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Yes, change chmod 660 amazon-dash.yml to chmod 600 amazon-dash.yml and chown root:root amazon-dash.yml to chown root amazon-dash.yml

@frankamp
Copy link
Author

Ok pip install goes:

error in amazon-dash setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in scapy;python_version<"3.0" at ;python_version<"3.0"

  
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2g/5dgtldh178x86fr0zrc09kf40000gp/T/pip-iqjbSG-build/
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.```

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

I just launched a new release. I'm going to check it, thanks.

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Please run in your system:

easy_install --version

@frankamp
Copy link
Author

frankamp commented Jul 18, 2018 via email

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Your Setuptools version is old (24 Jun 2015), you can upgrade It using:

pip install -U setuptools

Thanks for notifying.

@frankamp
Copy link
Author

frankamp commented Jul 18, 2018

sudo pip install https://github.com/Nekmo/amazon-dash/archive/develop.zip

Password:
The directory '/Users/jfrankamp/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/jfrankamp/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting https://github.com/Nekmo/amazon-dash/archive/develop.zip
  Downloading https://github.com/Nekmo/amazon-dash/archive/develop.zip
     / 1.4MB 4.4MB/s
Requirement already satisfied: PyYAML>=3.0 in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: jsonschema in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: click in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: click-default-group in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: scapy in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: subprocess32 in /usr/local/lib/python2.7/site-packages (from amazon-dash==1.1.0)
Requirement already satisfied: functools32; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from jsonschema->amazon-dash==1.1.0)
Installing collected packages: amazon-dash
  Running setup.py install for amazon-dash ... done
Successfully installed amazon-dash-1.1.0

then to run

➜  ~ chown root amazon-dash.yml
➜  ~ sudo chmod 600 amazon-dash.yml
➜  ~ sudo amazon-dash
Welcome to Amazon-dash v1.1.0 using Python 2.7.10
Listening for events. Amazon-dash will execute the events associated with the registered buttons.
ifconfig: interface vboxnet does not exist
ifconfig: interface vboxnet does not exist
ifconfig: interface vboxnet does not exist

(daemon running)

hit the Cascade button and spotify played my song.

Thanks! Looks good!

@Nekmo
Copy link
Owner

Nekmo commented Jul 18, 2018

Thanks for your help :)

@Nekmo Nekmo closed this as completed Jul 18, 2018
@Nekmo Nekmo removed this from the v1.1.1 milestone Jul 18, 2018
@Nekmo Nekmo added this to the v1.1.0 milestone Jul 18, 2018
Nekmo added a commit that referenced this issue Dec 17, 2018
@Nekmo Nekmo modified the milestones: v1.1.0, v1.3.1, v1.3.2 Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants