-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign sync and add it to add/remove/upgrade
More pip internals are now abstracted away in _pip. build_wheel now returns a wheel object directly. Installation and uninstallation operations are both wrapped for easy access. With the new abstraction, installations are now prepared before any of them are actually applied, so we are less likely to end up with broken environments due to build failures.
- Loading branch information
Showing
15 changed files
with
519 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
``sync`` is redisigned to be intergrated into ``add``, ``remove``, and ``upgrade``. Various ``clean`` operations are added to purge unneeded packages from the environment. ``install`` is added as a combination of ``lock`` and ``sync``. |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding=utf-8 -*- | ||
|
||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
from ._base import BaseCommand | ||
|
||
|
||
def main(options): | ||
from passa.operations.sync import clean | ||
from passa.synchronizers import Cleaner | ||
|
||
project = options.project | ||
cleaner = Cleaner(project, default=True, develop=options.dev) | ||
|
||
success = clean(cleaner) | ||
if not success: | ||
return 1 | ||
|
||
print("Cleaned project at", project.root) | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
name = "clean" | ||
description = "Uninstall unlisted packages from the current environment." | ||
parsed_main = main | ||
|
||
def add_arguments(self): | ||
super(Command, self).add_arguments() | ||
self.parser.add_argument( | ||
"--no-dev", dest="dev", | ||
action="store_false", default=True, | ||
help="uninstall develop packages, only keep default ones", | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
Command.run_current_module() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# -*- coding=utf-8 -*- | ||
|
||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
from ._base import BaseCommand | ||
|
||
|
||
def main(options): | ||
from passa.lockers import BasicLocker | ||
from passa.operations.lock import lock | ||
|
||
project = options.project | ||
|
||
if not options.check or not project.is_synced(): | ||
locker = BasicLocker(project) | ||
success = lock(locker) | ||
if not success: | ||
return 1 | ||
project._l.write() | ||
print("Written to project at", project.root) | ||
|
||
from passa.operations.sync import sync | ||
from passa.synchronizers import Synchronizer | ||
|
||
syncer = Synchronizer( | ||
project, default=True, develop=options.dev, | ||
clean_unneeded=options.clean, | ||
) | ||
|
||
success = sync(syncer) | ||
if not success: | ||
return 1 | ||
|
||
print("Synchronized project at", project.root) | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
name = "install" | ||
description = "Generate Pipfile.lock to synchronize the environment." | ||
parsed_main = main | ||
|
||
def add_arguments(self): | ||
super(Command, self).add_arguments() | ||
self.parser.add_argument( | ||
"--no-check", dest="check", | ||
action="store_false", default=True, | ||
help="do not check if Pipfile.lock is update, always resolve", | ||
) | ||
self.parser.add_argument( | ||
"--dev", | ||
action="store_true", | ||
help="install develop packages", | ||
) | ||
self.parser.add_argument( | ||
"--no-clean", dest="clean", | ||
action="store_false", default=True, | ||
help="do not uninstall packages not specified in Pipfile.lock", | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
Command.run_current_module() |
This file contains 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
This file contains 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
Oops, something went wrong.