classification
Title: Cannot initialize the distutils "force" command-option
Type: behavior Stage: patch review
Components: Distutils Versions: Python 3.8, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Opher Shachar, dstufft, eric.araujo
Priority: normal Keywords: patch, patch, patch, patch

Created on 2019-01-11 16:01 by Opher Shachar, last changed 2019-01-11 21:54 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 11526 open Opher Shachar, 2019-01-11 18:14
PR 11526 open Opher Shachar, 2019-01-11 18:14
PR 11526 Opher Shachar, 2019-01-11 18:14
PR 11526 open Opher Shachar, 2019-01-11 18:14
Messages (3)
msg333481 - (view) Author: Opher Shachar (Opher Shachar) * Date: 2019-01-11 16:01
When creating a custom Command (or sub-classing one) we cannot initialize in "initialize_options()" the "force" option to 1, because Command.__init__ resets it to None after the call to self.initialize_options().
msg333495 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2019-01-11 18:16
Could you tell how you found the problem, i.e. what are you trying to do?
msg333500 - (view) Author: Opher Shachar (Opher Shachar) * Date: 2019-01-11 19:19
(from the PR11526)
In this build_py subclass I initialize force to 1, but when reaching byte_compile() we find out it was reset to None.

from setuptools.command.build_py import build_py as _build_py

class build_py(_build_py):
    def initialize_options(self):
        _build_py.initialize_options(self)
        self.force = 1
        self.compile = 1

    def byte_compile(self, files):
        # self.compile == 1
        # self.force == None
        _build_py.byte_compile(self, files)
        # do stuff...
History
Date User Action Args
2019-01-11 21:54:02terry.reedysetkeywords: patch, patch, patch, patch
title: Cannot initialize the "force" command-option -> Cannot initialize the distutils "force" command-option
2019-01-11 19:19:13Opher Shacharsetmessages: + msg333500
2019-01-11 18:16:26eric.araujosetkeywords: patch, patch, patch, patch

messages: + msg333495
2019-01-11 18:14:47Opher Shacharsetkeywords: + patch
stage: patch review
pull_requests: + pull_request11111
2019-01-11 18:14:40Opher Shacharsetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11112
2019-01-11 18:14:35Opher Shacharsetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11110
2019-01-11 18:14:28Opher Shacharsetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11109
2019-01-11 16:01:26Opher Shacharcreate