diff options
author | Filipp Lepalaan <filipp@mac.com> | 2017-11-01 17:59:51 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2017-11-01 17:59:51 +0200 |
commit | 60216c4bbec1d4006fc86c2cdd412cdca6c87120 (patch) | |
tree | 94677b1ff2c561cf0efbe4df1cdca6429646dd03 | |
parent | ad9c6dc0b0f5477535b1cc2a9cb8627aaffe30db (diff) | |
download | machammer-60216c4bbec1d4006fc86c2cdd412cdca6c87120.tar.gz machammer-60216c4bbec1d4006fc86c2cdd412cdca6c87120.tar.bz2 machammer-60216c4bbec1d4006fc86c2cdd412cdca6c87120.zip |
Python 3 fixes
-rw-r--r-- | machammer/__init__.py | 4 | ||||
-rw-r--r-- | machammer/decorators.py | 2 | ||||
-rw-r--r-- | machammer/functions.py | 4 | ||||
-rw-r--r-- | machammer/hooks.py | 2 | ||||
-rwxr-xr-x | tests.py | 4 |
5 files changed, 9 insertions, 7 deletions
diff --git a/machammer/__init__.py b/machammer/__init__.py index 1ab391e..ccd52c7 100644 --- a/machammer/__init__.py +++ b/machammer/__init__.py @@ -1,6 +1,8 @@ __all__ = ['functions', 'printers', 'system_profiler'] __title__ = 'machammer' +__name__ = 'machammer' +__package__ = 'machammer' __author__ = 'Filipp Lepalaan' __version__ = '0.1' __license__ = 'MIT' -__copyright__ = 'Copyright 2016 Filipp Lepalaan' +__copyright__ = 'Copyright 2017 Filipp Lepalaan' diff --git a/machammer/decorators.py b/machammer/decorators.py index b73b52f..987cc5d 100644 --- a/machammer/decorators.py +++ b/machammer/decorators.py @@ -5,7 +5,7 @@ import os import stat import inspect -import hooks +from . import hooks APP_SUPPORT_DIR = '/Library/Application Support/' APP_ID = 'com.github.filipp.machammer' diff --git a/machammer/functions.py b/machammer/functions.py index 8ae0183..0031e61 100644 --- a/machammer/functions.py +++ b/machammer/functions.py @@ -146,10 +146,10 @@ def is_desktop(): return not is_laptop() -def mount_image(path): +def mount_image(path, mp=None): """Mount disk image and return path to mountpoint.""" logging.debug('Mounting DMG %s' % path) - mp = tempfile.mkdtemp() + mp = mp or tempfile.mkdtemp() p = subprocess.Popen(['/usr/bin/hdiutil', 'mount', '-mountpoint', mp, '-nobrowse', path], diff --git a/machammer/hooks.py b/machammer/hooks.py index f975aca..ccb1526 100644 --- a/machammer/hooks.py +++ b/machammer/hooks.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import defaults +from . import defaults PREF_DOMAIN = 'com.apple.loginwindow' @@ -143,10 +143,10 @@ class FunctionsTestCase(TestCase): def test_remove_login_item(self): users.remove_login_item(path=self.stickes) - + def test_mount_image(self): p = functions.mount_image(os.getenv('MH_IMAGE')) - self.assertEquals(p, '/Volumes/Adobe Flash Player Installer') + self.assertIn('/var/folders', p) @skip('This works, trust me.') def test_create_media(self): |