Git Product home page Git Product logo

machotools's Introduction

Machotools is a small set of tools built on top of macholib to retrieve and change informations about mach-o files. Think of it as a pure python, cross-platform implementation of install_name_tool

Examples:

# Print the list of rpath defined in the given .dylib
python -m machotools list_rpaths foo.dylib

# Print the id (i.e. install_name) of the given .dylib
python -m machotools install_name foo.dylib

# Print the list of libraries linked in the given mach-o (simple otool
# -L)
python -m machotools list_libraries a.out

Internally, machotools is written as a library so that it can be used within bigger tools, but the API is currently in-flux until the first 1.0 release.

Example:

from machotools import rewriter_factory

rewriter = rewriter_factory("foo.dylib")
print rewriter.dependencies
# install_name property only available if rewriter is a DylibRewriter
# instance (auto-detected in rewriter_factory)
print rewriter.install_name
print rewriter.rpaths

rewriter.install_name = "bar.dylib"
# Changes are not actually written until you call commit()
rewriter.commit()

# When modifying a binary, one can also use context manager so that
# changes are automatically committed when exciting the context.
with rewriter_factory("foo.dylib") as rewriter:
    rewriter.install_name = "bar.dylib"

Main features:

  • ability to query/change rpath
  • ability to query/change the install name
  • ability to query/change the dependencies
  • should work on any platform supported by macholib (mac os x, unix, windows)
  • modifications are safe against crash/interruption as files are never modified in place. Instead, modifications are made against a temporary copy, and replace the original file using atomic rename on Posix (emulated on windows).

Development happens on github

TODO:

  • support for multi arch
  • more detailed output for list_libraries (including versioning info)

machotools's People

Contributors

cournape avatar

Watchers

James Cloos avatar Philippe Ombredanne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.