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

Inherit clean command so that it supports the usual flags. #732

Merged
merged 1 commit into from Mar 9, 2017

Conversation

Projects
None yet
2 participants
@DanLipsitt
Copy link
Contributor

commented Jan 19, 2015

Debian packaging tools expect setup.py to take the --all flag (and its abbreviation, -a). This PR meets those needs by subclassing the standard setuptools clean command, which supports those flags.

This PR changes the semantics of setup.py slightly compared to previous versions of Octoprint. '--all' now needs to be passed in order to delete everything that is deleted by previous versions. Some additional build files may also be deleted.

Dan Lipsitt
Inherit clean command so that it supports the usual flags.
This changes the semantics of setup.py slightly. '--all' needs to be
passed in order to delete everything that is deleted by previous
versions. Some additional build files may also be deleted.
@DanLipsitt

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2015

Oops, I might have based this on the wrong branch. I'll take another look.

@foosel

This comment has been minimized.

Copy link
Owner

commented Jan 20, 2015

The branch is just fine, but it doesn't work just like that, since self.build_temp is not available upon running that due to not being invoked by the overriding implementation:

$ ../devenv/Scripts/python setup.py clean
running clean
Traceback (most recent call last):
  File "setup.py", line 302, in <module>
    setup(**params())
  File "c:\Python27\Lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "c:\Python27\Lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "c:\Python27\Lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 69, in run
    OriginalCleanCommand.run(self)
  File "c:\Python27\Lib\distutils\command\clean.py", line 54, in run
    if os.path.exists(self.build_temp):
  File "c:\Python27\Lib\distutils\cmd.py", line 105, in __getattr__
    raise AttributeError, attr
AttributeError: build_temp

Wanna fix this or should I? :)

@DanLipsitt

This comment has been minimized.

Copy link
Contributor Author

commented Jan 20, 2015

The branch seems okay, the problem is that it doesn't merge against your devel branch right now.

However, I don't understand the issue with build_temp, and I can't replicate it locally in a fresh virtualenv and checkout:

$ git reset --hard feature/inherit-clean 
HEAD is now at 3261ef9 Inherit clean command so that it supports the usual flags.
$ python ./setup.py clean
/Users/dan/.virtualenvs/tmp-c849bbe4eda935e6/lib/python2.7/site-packages/setuptools/dist.py:293: UserWarning: The version specified ('1.1.0-dev-232-g3261ef9') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % self.metadata.version
running clean

This works after setup.py build as well. I'm happy to work on it more but I don't know how at the moment.

foosel added a commit that referenced this pull request Mar 9, 2017

Removed bits from clean command made redundant by #732
Force --all on stock clean command unless --orig is specified, in
which case "python setup.py clean" behaves like the stock clean
command. Additionally there are now --noeggs to skip egg deletion and
--nopyc to skip pyc deletion.

@foosel foosel merged commit 4683fa3 into foosel:devel Mar 9, 2017

@foosel

This comment has been minimized.

Copy link
Owner

commented Mar 9, 2017

I've (finally) come around to take another look at this and I still could reproduce the above error. However I've now fixed things, and without changing semantics of the command compared to current behaviour.

I overrode the command option finalisation so that --all is always set, unless --orig is provided (in which case the command behaves exactly like stock, no egg clean up, no pyc cleanup). Additionally I've added --nopyc and --noegg to prevent those steps from happening. I've also removed redundancy, the build folder no longer needs to be cleaned manually since the stock procedure already takes care of that when --all is provided and the folder is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.