Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global properties from command line has to be set immediately #515

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexeySanko
Copy link
Contributor

Unfortunately, global property values from command line aren't set immediately after project object creation. And we cannot use it for plugins behaviour manage.

@coveralls
Copy link

coveralls commented Oct 27, 2017

Coverage Status

Coverage increased (+0.006%) to 75.012% when pulling 699404b on AlexeySanko:hotfix/command_line_properties into d0f8f80 on pybuilder:master.

@arcivanov
Copy link
Member

Could you please rebase on latest master?

@coveralls
Copy link

coveralls commented Nov 17, 2017

Coverage Status

Coverage remained the same at 74.971% when pulling 82555d3 on AlexeySanko:hotfix/command_line_properties into 82acc02 on pybuilder:master.

@AlexeySanko
Copy link
Contributor Author

Thanks. Rebased.

@arcivanov
Copy link
Member

I have to think about this a bit more. This modifies the default behavior and I'm not sure yet what the negative implications of this will be.

@AlexeySanko
Copy link
Contributor Author

Marked as useless. Closed.

@arcivanov
Copy link
Member

Huh?

@arcivanov arcivanov reopened this Nov 18, 2017
@coveralls
Copy link

coveralls commented Nov 18, 2017

Coverage Status

Coverage remained the same at 74.971% when pulling 82555d3 on AlexeySanko:hotfix/command_line_properties into 82acc02 on pybuilder:master.

@AlexeySanko AlexeySanko mentioned this pull request Nov 22, 2017
@AlexeySanko
Copy link
Contributor Author

AlexeySanko commented Nov 22, 2017

Ok. Let's repeat step by step what I did when create PR

        self.project = Project(basedir=project_directory)
        self.project_module = self.load_project_module(project_descriptor)
        self.apply_project_attributes()
        self.override_properties(property_overrides)

So in this case we have two statements which will be affected by override_properties movement: load_project_module and apply_project_attributes.

override_properties calls only self.project.set_property and affects only project properties dict. So we need to understand how project properties dict could be change into load_project_module and apply_project_attributes.

load_project_module call imp.load_source and push result to self.project_module. It doesn't affect self.project object.

apply_project_attributes just push attributes self.project_module to self.project attributes. It could affect properties dict if some setter has mirror to property dict.
Let's check:

        self.propagate_property("name")
        self.propagate_property("version")
        self.propagate_property("default_task")
        self.propagate_property("summary")
        self.propagate_property("home_page")
        self.propagate_property("description")
        self.propagate_property("authors")
        self.propagate_property("license")
        self.propagate_property("url")
        self.propagate_property("explicit_namespaces")
        self.propagate_property("requires_python")
        self.propagate_property("obsoletes")

@version.setter - doesn't affect property dict
@requires_python.setter - doesn't affect property dict
@obsoletes.setter - doesn't affect property dict
@explicit_namespaces.setter - doesn't affect property dict

So in this case we have only one way to affect project properties dict into these two steps:

project = Reactor.current_instance().project
project.set_property('install_dependencies_extra_index_url', 'pypi url')

into build.py or any other plugin.
It looks like a hack instead of using tool by expected way.

Currect sequence of getting values into project property dict:
dirty hack -> command line -> inits
If we add possibility to propagate attributes to properties:
dirty hack -> propagation from build.py -> command line -> inits
Why command line replace attributes from build.py?

From logical point of view sequence of applying could be equal to sequence of calls.
command line -> import stage (propogation and hacks) -> init

Cons:
We will affect dirty hack with Reactor.current_instance().project usage - system will not replace dirty hack properties with command line properties

Does anybody really use this logic with replacement dirty hack properties with command line properties? Really???? Simpler contribute PyB than find this possibility.

Pros:
We will get properties from command line as first step. And could manage ANY building step. And we can use existing finctionality instead of adding any additional task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants