Re: [Zope-dev] Removing dependency between zope.location and zope.copy

2009-12-22 Thread Dan Korostelev
2009/12/22 Fabio Tranchitella kob...@kobold.it:
 I'm wondering if it would be possible to drop the dependency between
 zope.location and zope.copy. It makes sense to me because zope.location
 depends on zope.copy only because it registers a LocationCopyHook, not
 because it is really using anything from that package.

 Attached to this message you can find my (proposed) patch to remove the
 dependency making the adapter registration optional, and informing the
 developer that zope.copy is needed is he is importing directly the
 zope.location.pickling module.

 Comments?

Looks okay :)

-- 
WBR, Dan Korostelev
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Removing dependency between zope.location and zope.copy

2009-12-22 Thread Martijn Faassen
Fabio Tranchitella wrote:
 Comments?

+1 from me.

Often instead of optional dependencies we'd move the registration to the 
other package, but that's not possible here as zope.copy doesn't depend 
on zope.location.

Regards,

Martijn

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Removing dependency between zope.location and zope.copy

2009-12-21 Thread Fabio Tranchitella
Hello,

I'm wondering if it would be possible to drop the dependency between
zope.location and zope.copy. It makes sense to me because zope.location
depends on zope.copy only because it registers a LocationCopyHook, not
because it is really using anything from that package.

Attached to this message you can find my (proposed) patch to remove the
dependency making the adapter registration optional, and informing the
developer that zope.copy is needed is he is importing directly the
zope.location.pickling module.

Comments?

Thanks,
Fabio
Index: buildout.cfg
===
--- buildout.cfg	(revisione 106858)
+++ buildout.cfg	(copia locale)
@@ -4,11 +4,11 @@
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = zope.location
+eggs = zope.location [test]
 
 [coverage-test]
 recipe = zc.recipe.testrunner
-eggs = zope.location
+eggs = zope.location [test]
 defaults = ['--coverage', '../../coverage']
 
 [coverage-report]
Index: src/zope/location/configure.zcml
===
--- src/zope/location/configure.zcml	(revisione 106858)
+++ src/zope/location/configure.zcml	(copia locale)
@@ -1,7 +1,9 @@
-configure xmlns=http://namespaces.zope.org/zope;
+configure xmlns=http://namespaces.zope.org/zope;
+   zcml:xmlns=http://namespaces.zope.org/zcml;
 
   adapter factory=.location.LocationProxy /
-  adapter factory=.pickling.LocationCopyHook /
+  adapter zcml:condition=installed zope.copy
+   factory=.pickling.LocationCopyHook /
   adapter factory=.traversing.LocationPhysicallyLocatable /
   adapter factory=.traversing.RootPhysicallyLocatable /
 
Index: src/zope/location/pickling.py
===
--- src/zope/location/pickling.py	(revisione 106858)
+++ src/zope/location/pickling.py	(copia locale)
@@ -18,13 +18,17 @@
 __docformat__ = 'restructuredtext'
 
 from zope.component import adapts
-from zope.copy.interfaces import ICopyHook, ResumeCopy
 from zope.interface import implements
-
 from zope.location.interfaces import ILocation
 from zope.location.location import inside
 
+try:
+from zope.copy.interfaces import ICopyHook, ResumeCopy
+except ImportError:
+raise NotImplementedError(zope.location.pickling is not supported 
+because zope.copy is not available)
 
+
 class LocationCopyHook(object):
 Copy hook to preserve copying referenced objects that are not
 located inside object that's being copied.
Index: setup.py
===
--- setup.py	(revisione 106858)
+++ setup.py	(copia locale)
@@ -56,13 +56,14 @@
   packages=find_packages('src'),
   package_dir = {'': 'src'},
   namespace_packages=['zope',],
+  tests_require=['zope.copy'],
   install_requires=['setuptools',
 'zope.interface',
 'zope.schema=3.5.1dev',
 'zope.component=3.8.0',
 'zope.proxy3.3',
-'zope.copy',
 ],
+  extras_require=dict(test=['zope.copy']),
   include_package_data = True,
   zip_safe = False,
   )
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )