Skip to content

Commit

Permalink
switch mount point to /Users/Shared
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham R Pugh committed Mar 26, 2021
1 parent a4577dd commit 54e6946
Show file tree
Hide file tree
Showing 6 changed files with 513 additions and 373 deletions.
264 changes: 130 additions & 134 deletions CHANGELOG.md

Large diffs are not rendered by default.

98 changes: 52 additions & 46 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
from __future__ import absolute_import
import os
import sys
sys.path.insert(0, os.path.abspath('../'))
#sys.path.append(os.path.abspath('../'))

sys.path.insert(0, os.path.abspath("../"))
# sys.path.append(os.path.abspath('../'))

# -- General configuration ------------------------------------------------

Expand All @@ -32,42 +33,42 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.doctest',
'sphinx.ext.napoleon',
'sphinx.ext.inheritance_diagram',
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.doctest",
"sphinx.ext.napoleon",
"sphinx.ext.inheritance_diagram",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'python-jss'
copyright = u'2018, sheagcraig'
author = u'sheagcraig'
project = u"python-jss"
copyright = u"2018, sheagcraig"
author = u"sheagcraig"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'2.1.0'
version = u"2.1.1"
# The full version, including alpha/beta/rc tags.
release = u'2.1.0'
release = u"2.1.1"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -88,7 +89,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -110,7 +111,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -124,12 +125,12 @@

# -- Options for HTML output ----------------------------------------------

#import sphinx_rtd_theme
# import sphinx_rtd_theme

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -139,7 +140,7 @@

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = []
#html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
Expand All @@ -164,7 +165,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -244,34 +245,36 @@
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'python-jssdoc'
htmlhelp_basename = "python-jssdoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'python-jss.tex', u'python-jss Documentation',
u'sheagcraig', 'manual'),
(
master_doc,
"python-jss.tex",
u"python-jss Documentation",
u"sheagcraig",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -311,10 +314,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'python-jss', u'python-jss Documentation',
[author], 1)
]
man_pages = [(master_doc, "python-jss", u"python-jss Documentation", [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -327,9 +327,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'python-jss', u'python-jss Documentation',
author, 'python-jss', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"python-jss",
u"python-jss Documentation",
author,
"python-jss",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down
15 changes: 11 additions & 4 deletions jss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@
from __future__ import absolute_import
from .casper import Casper
from .curl_adapter import CurlAdapter
from .distribution_point import (AFPDistributionPoint, SMBDistributionPoint,
JDS, CDP, LocalRepository, JCDS, AWS)
from .distribution_point import (
AFPDistributionPoint,
SMBDistributionPoint,
JDS,
CDP,
LocalRepository,
JCDS,
AWS,
)
from .distribution_points import DistributionPoints
from .exceptions import *
from .jamf_software_server import JSS
Expand All @@ -71,7 +78,7 @@

import sys

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
sys.path.insert(0, "/Library/AutoPkg/JSSImporter")
import requests

from .tools import is_osx, is_linux, element_str
Expand All @@ -80,4 +87,4 @@
from .jssobjectlist import JSSObjectList


__version__ = "2.1.0"
__version__ = "2.1.1"
27 changes: 17 additions & 10 deletions jss/contrib/mount_shares_better.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
# pylint: disable=no-name-in-module
from CoreFoundation import CFURLCreateWithString
import Foundation # pylint: disable=unused-import
from objc import (initFrameworkWrapper, pathForFramework, loadBundleFunctions)
from objc import initFrameworkWrapper, pathForFramework, loadBundleFunctions

# pylint: enable=no-name-in-module


class AttrDict(dict):
"""Attribute Dictionary"""

__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__

Expand All @@ -36,19 +38,22 @@ class AttrDict(dict):
# scan_classes=False means only add the contents of this Framework.
# pylint: disable=invalid-name
NetFS_bundle = initFrameworkWrapper(
'NetFS', frameworkIdentifier=None,
frameworkPath=pathForFramework('NetFS.framework'), globals=NetFS,
scan_classes=False)
"NetFS",
frameworkIdentifier=None,
frameworkPath=pathForFramework("NetFS.framework"),
globals=NetFS,
scan_classes=False,
)
# pylint: enable=invalid-name

# https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html
# Fix NetFSMountURLSync signature
del NetFS['NetFSMountURLSync']
loadBundleFunctions(NetFS_bundle, NetFS, [('NetFSMountURLSync', b'i@@@@@@o^@')])
del NetFS["NetFSMountURLSync"]
loadBundleFunctions(NetFS_bundle, NetFS, [("NetFSMountURLSync", b"i@@@@@@o^@")])


def mount_share(share_path):
"""Mounts a share at /Volumes
"""Mounts a share at /Users/Shared
Args:
share_path: String URL with all auth info to connect to file share.
Expand All @@ -70,7 +75,8 @@ def mount_share(share_path):
mount_options = {NetFS.kNetFSAllowSubMountsKey: True}
# Build our connected pointers for our results
result, output = NetFS.NetFSMountURLSync(
sh_url, None, None, None, open_options, mount_options, None)
sh_url, None, None, None, open_options, mount_options, None
)

# Check if it worked
if result != 0:
Expand All @@ -81,5 +87,6 @@ def mount_share(share_path):

def is_high_sierra():
version = StrictVersion(
subprocess.check_output(['sw_vers', '-productVersion']).decode().strip())
return version >= StrictVersion('10.13')
subprocess.check_output(["sw_vers", "-productVersion"]).decode().strip()
)
return version >= StrictVersion("10.13")
Loading

0 comments on commit 54e6946

Please sign in to comment.