You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Justin Ross (JIRA)" <ji...@apache.org> on 2016/01/06 16:19:40 UTC

[jira] [Closed] (QPID-4578) Support packaging qpid-python in py2exe executables

     [ https://issues.apache.org/jira/browse/QPID-4578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Ross closed QPID-4578.
-----------------------------
    Resolution: Won't Fix

Forward development for Python is now focused on the Proton Python binding.  As a result, we are considering only defects and minor improvements for the Python qpid.messaging API.  These issues are closed "won't fix" because they are improvements outside of that scope.

> Support packaging qpid-python in py2exe executables
> ---------------------------------------------------
>
>                 Key: QPID-4578
>                 URL: https://issues.apache.org/jira/browse/QPID-4578
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Python Client
>    Affects Versions: 0.20
>         Environment: Py2exe build for windows
>            Reporter: Matthew Hughes
>            Priority: Minor
>
> The data files in .../qpid-python/python/qpid/specs (i.e. amqp-0-10.dtd, amqp-0-8.xml, amqp-0-9.xml) are accessed using a base path of __file__, which is not available if byte compiled into a py2exe (or pyInstaller) executable. The patch below works around this issue. 
> I thought this might be useful for others ...
> --Matt Hughes
> Index: specs_config.py
> ===================================================================
> --- specs_config.py	(revision 47091)
> +++ specs_config.py	(revision 47092)
> @@ -18,8 +18,20 @@
>  #
>  
>  import os
> +import imp
> +import sys
>  
> -AMQP_SPEC_DIR=os.path.join(os.path.dirname(os.path.abspath(__file__)), "specs")
> +def is_frozen():
> +   return (hasattr(sys, "frozen") or # new py2exe
> +           hasattr(sys, "importers") # old py2exe
> +           or imp.is_frozen("__main__")) # tools/freeze
> +
> +if is_frozen:
> +    basepath = os.path.dirname(os.path.abspath(sys.executable))
> +else:
> +    basepath = os.path.dirname(os.path.abspath(__file__))
> +    
> +AMQP_SPEC_DIR=os.path.join(basepath, "specs")
>  amqp_spec = os.path.join(AMQP_SPEC_DIR, "amqp-0-10-qpid-errata.xml")
>  amqp_spec_0_8 = os.path.join(AMQP_SPEC_DIR, "amqp-0-8.xml")
>  amqp_spec_0_9 = os.path.join(AMQP_SPEC_DIR, "amqp-0-9.xml")



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org