Created
February 11, 2014 00:13
-
-
Save markmevans/8926906 to your computer and use it in GitHub Desktop.
A hack for PyBuilder build.py files so `pyb publish` will work in a filesystem that does not support hardlinks (like VirtualBox shared filesystems.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Hack the distutils_plugin's SETUP_TEMPLATE to disable hardlinks. | |
# | |
import string | |
from pybuilder.core import init | |
from pybuilder.plugins.python import distutils_plugin | |
SDIST_MONKEY_PATCH = """ | |
# sdist_hack: Remove reference to os.link to disable using hardlinks when | |
# building setup.py's sdist target. This is done because | |
# VirtualBox VMs shared filesystems don't support hardlinks. | |
import os | |
del os.link | |
""" | |
@init | |
def initialize_sdist_hack(project): | |
# | |
# Monkey patch distutils_plugin's SETUP_TEMPLATE to disable hardlinks. | |
# | |
setup_template_array = distutils_plugin.SETUP_TEMPLATE.template.split('\n') | |
setup_template_array.insert(1, SDIST_MONKEY_PATCH) | |
distutils_plugin.SETUP_TEMPLATE = string.Template( | |
'\n'.join(setup_template_array) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment