classification
Title: Make .pypirc handle multiple servers
Type: enhancement Stage:
Components: Distutils Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, christian.heimes, loewis, tarek
Priority: normal Keywords: patch

Created on 2008-01-17 12:32 by tarek, last changed 2008-05-24 09:08 by tarek. This issue is now closed.

Files
File name Uploaded Description Edit
distutils.2008.03.12.patch tarek, 2008-03-12 20:01
Messages (20)
msg60025 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-01-17 12:32
explained here: http://wiki.python.org/moin/EnhancedPyPI

The patch also adds unit tests for command/register.py and
command/upload.py
msg60058 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-17 20:48
I've changed the target version to 2.6+. We can't add new features to
2.5 and earlier.
msg62687 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-02-22 14:47
please could you remove the deprecated patch.diff ? thanks :)
msg62752 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-02-23 15:36
The last patch also fixes the HOME issues under Windows: #1531505,
#1741, #2166 where .pypirc and .pydistutils.cfg were not found. It is
not using os.path.expanduser to simplify the code usage (~\/ is rather
unreadable) (see the get_home() function in util.py)
msg62759 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-02-23 15:59
I have changed the patch so it uses expanduser (took back tiran's
example from #2166)
msg62838 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-02-23 23:15
Random notes on bugday.distutils.patch:

* dist.py: this change should definitely be applied, no matter what 
  happens to the rest of the patch.

* Yay!  Lots of tests!

* distutils.pypirc: I'm doubtful of the finalize_options() here;
  looking for '-r' in the args seems like it could get confused 
  if there are packages or other arguments that just happen
  to use that name.  It seems like a remote possibility, but still...

* distutils.pypirc: Class name typo in module docstring.
  
* Would the distutils.pypirc module be better named something like
  distutils.config?

* register.py: why use PyPIRCCommand.DEFAULT_REPOSITORY 
  and not register.DEFAULT_REPOSITORY?  I guess it's more useful to
  have a single Distutil-wide default repository.  No action needed.
msg62839 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-02-23 23:19
* I like factoring out the .pypirc code into a separate class.

* Overall I think the patch is acceptable.  We'd need to decide whether
  the new .pypirc is considered suitable -- I don't remember the reaction
  to it on the distutils-sig or catalog-sig -- but this patch seems
  like a decent implementation of the new format.
msg62948 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-02-24 22:15
for the -r option, is has to be catched by both register and upload when
the command is called like this :

  $ python setup.py register sdist upload -r my-pypi

without the args lookup, register will get an empty value for -r. 

This option seems to me quite global to distutils.
msg63296 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-03-05 21:54
I have changed the code: the pypirc module is now called config.
msg63457 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-03-11 00:49
patch with more tests and explanations...

for the -r option, the standard call without the change would be:

$ python setup.py register -r pypi sdist upload -r pypi

which is very redundant. That's why config.py looks into args.

To avoid collisions, the right thing to do imho would be to have a
"shared_options" dict in the command classes to allow a given command
to get some options from another.

For instance, in the register command, in pseudo-code:

class register:
  shared_options = {'upload': ['repository']} 

and in the upload one:

class upload:
  shared_options = {'register': ['repository']} 

If register and upload are both present in the command line, then the
option is made available to both commands.

For instance, this two lines would provide the repository to the two
commands:

$ python setup.py register -r pypi sdist upload
$ python setup.py register sdist upload -r pypi (preferred way)

But this will be a patch proposition on its own.
msg63458 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-03-11 01:39
making the contracted repository name work with verify_metadata and
list_classifiers
msg66562 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-05-10 18:54
Is the only purpose of the '-r' in sys.argv code to 
avoid having to specify arguments multiple times when you're doing 
multiple commands on a line?  Perhaps it would be acceptable to then 
just drop that bit of code completely; having to specify 'register -r 
pypi upload -r pypi' isn't the worst thing in the world, and it avoids 
worrying about oddball corner cases like 'setup.py newcommand -r 
something-different upload -r pypi'.

So, I'd suggest just taking that code out, and then committing the 
patch.
msg66564 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-05-10 18:57
yes that was just for conveniency, so I guess it can be removed
msg66576 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-05-10 19:55
Committed to trunk as r62998; thank you very much for the patch!
msg66631 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-05-11 14:01
Brett backed out my commit in r63002 because I forgot to include the
distutils.config module.  Re-committed in r63014 and r63060.
msg66719 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-05-12 12:08
Thanks for the integration work !

I was wondering: since it superseeds two bugs (issue1741, issue2166)
that where marked to be backported in 2.5.x, should I write 2.5 specific 
patches for those particular fixes ? (windows paths related issues)
msg67283 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-05-24 05:28
This patch has broken test_distutils, which now reports

test_distutils
test test_distutils produced unexpected output:
**********************************************************************
Using PyPI login from /home/martin/work/py2.6/Lib/distutils/tests/.pypirc
Using PyPI login from /home/martin/work/py2.6/Lib/distutils/tests/.pypirc
Using PyPI login from /home/martin/work/py2.6/Lib/distutils/tests/.pypirc
Using PyPI login from /home/martin/work/py2.6/Lib/distutils/tests/.pypirc
Using PyPI login from /home/martin/work/py2.6/Lib/distutils/tests/.pypirc

**********************************************************************
msg67284 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-05-24 07:01
This is because the code uses a print statement when opening the .pypirc
file. This was already the case before this patch, but the code was not
covered by tests. (see in previous revision)

The test is not broken, it just ouputs to stdin. 

I would suggest closing this issue and opening a new one entitled:
"distutils should used the logging module to produce output" maybe ?
msg67286 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-05-24 09:02
> This is because the code uses a print statement when opening the .pypirc
> file. This was already the case before this patch, but the code was not
> covered by tests. (see in previous revision)
> 
> The test is not broken, it just ouputs to stdin. 
> 
> I would suggest closing this issue and opening a new one entitled:
> "distutils should used the logging module to produce output" maybe ?

The test *is* (or was) broken - regrtest reported it as a failure.
It effectively, actually, caused a failure of the buildbot slaves.
In any case, I have now replaced the print with self.announce, in
r63575.
msg67287 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2008-05-24 09:08
Right, Thanks!
History
Date User Action Args
2009-03-30 04:22:22ajaksu2linkissue1531505 superseder
2008-05-24 09:08:29tareksetmessages: + msg67287
2008-05-24 09:02:29loewissetmessages: + msg67286
2008-05-24 07:01:26tareksetmessages: + msg67284
2008-05-24 05:29:14loewissetnosy: + loewis
messages: + msg67283
2008-05-12 12:08:13tareksetmessages: + msg66719
2008-05-11 14:01:31akuchlingsetmessages: + msg66631
2008-05-10 19:55:06akuchlingsetstatus: open -> closed
keywords: - easy
resolution: accepted
messages: + msg66576
2008-05-10 18:57:34tareksetmessages: + msg66564
2008-05-10 18:54:20akuchlingsetmessages: + msg66562
2008-05-10 17:50:04akuchlingsetassignee: akuchling
2008-03-22 15:00:20tareksetfiles: - distutils.2008.03.11.patch
2008-03-22 15:00:15tareksetfiles: - distutils.2008.03.11.patch
2008-03-22 15:00:12tareksetfiles: - distutils.2008-03-05.patch
2008-03-22 15:00:09tareksetfiles: - bugday.distutils.patch
2008-03-22 15:00:05tareksetfiles: - bugday-distutils.patch
2008-03-22 15:00:02tareksetfiles: - distutils.patch
2008-03-20 00:30:36jafolinkissue1741 superseder
2008-03-20 00:28:49jafolinkissue2166 superseder
2008-03-12 20:02:00tareksetfiles: + distutils.2008.03.12.patch
2008-03-11 01:39:58tareksetfiles: + distutils.2008.03.11.patch
messages: + msg63458
2008-03-11 00:49:47tareksetfiles: + distutils.2008.03.11.patch
messages: + msg63457
2008-03-05 21:54:19tareksetfiles: + distutils.2008-03-05.patch
messages: + msg63296
2008-02-24 22:15:57tareksetmessages: + msg62948
2008-02-23 23:19:40akuchlingsetmessages: + msg62839
2008-02-23 23:15:23akuchlingsetnosy: + akuchling
messages: + msg62838
2008-02-23 16:00:05tareksetfiles: + bugday.distutils.patch
2008-02-23 15:59:34tareksetmessages: + msg62759
2008-02-23 15:36:43tareksetfiles: + bugday-distutils.patch
messages: + msg62752
2008-02-23 13:23:16facundobatistasetfiles: - patch.diff
2008-02-22 14:47:29tareksetmessages: + msg62687
2008-02-22 14:46:43tareksetfiles: + distutils.patch
2008-01-17 20:48:09christian.heimessetversions: + Python 3.0, - Python 2.5, Python 2.4
nosy: + christian.heimes
messages: + msg60058
priority: normal
keywords: + patch, easy
type: enhancement
2008-01-17 12:32:53tarekcreate