Skip to content

how to execute a script that will modify my package at build time? #3909

Answered by abravalheri
12rambau asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @12rambau maybe a custom build sub-command would work for you?

Something like:

# setup.py
import os
import sys
from setuptools immport Command, setup
from setuptools.command.build import build

sys.path.append(os.path.dirname(__file__))

from genreate_source import generate_schema, generate_source


class custom_build(build):
    sub_commands = [("build_vuetify", None), *build.sub_commands]


class build_vuetify(build):
    # See interface in https://setuptools.pypa.io/en/latest/userguide/extension.html

    def initialize_options(self):
        self.editable_mode = False
        self.build_lib = None
        ...

    def finalize_options(self):
        self.set_undefined_options('build'

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by 12rambau
Comment options

You must be logged in to vote
4 replies
@abravalheri
Comment options

@12rambau
Comment options

@abravalheri
Comment options

@12rambau
Comment options

Comment options

You must be logged in to vote
5 replies
@abravalheri
Comment options

@12rambau
Comment options

@abravalheri
Comment options

@abravalheri
Comment options

@12rambau
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants