I try to build a universal wheel, but it rolls away - python

I run:
python3 setup.py bdist_wheel --universal
It says it's making all sorts of stuff, but then the resulting directory (build/bdist.macosx-10.10-x86_64) is empty. Where did my wheel roll away to?t
Edit
I now see that I'm trying to look at the temp output. When I specify -d, sure enough, there's a wheel in the designated location. Does -d have a default? Has my wheel been parked under my nose all along?
running bdist_wheel
running build
running build_py
running egg_info
writing dependency_links to rosapi_launcher.egg-info/dependency_links.txt
writing top-level names to rosapi_launcher.egg-info/top_level.txt
writing rosapi_launcher.egg-info/PKG-INFO
writing requirements to rosapi_launcher.egg-info/requires.txt
reading manifest file 'rosapi_launcher.egg-info/SOURCES.txt'
writing manifest file 'rosapi_launcher.egg-info/SOURCES.txt'
installing to build/bdist.macosx-10.10-x86_64/wheel
running install
running install_lib
creating build/bdist.macosx-10.10-x86_64/wheel
creating build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/__init__.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/containers.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/launcher.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/prop_file.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/properties.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/snapshots.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
copying build/lib/launcher/utils.py -> build/bdist.macosx-10.10-x86_64/wheel/launcher
running install_egg_info
Copying rosapi_launcher.egg-info to build/bdist.macosx-10.10-x86_64/wheel/rosapi_launcher-0.0.1-py3.4.egg-info
running install_scripts
creating build/bdist.macosx-10.10-x86_64/wheel/rosapi_launcher-0.0.1.dist-info/WHEEL
My setup.py is:
from setuptools import setup
import io
import os
import launcher
here = os.path.abspath(os.path.dirname(__file__))
# noinspection PyPackageRequirements
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)
long_description = read('README.txt', 'CHANGES.txt')
setup(
name='rosapi-launcher',
version=launcher.__version__,
install_requires=['pyaml',
'boto3'
],
description='RosAPI launcher',
long_description=long_description,
packages=['launcher'],
include_package_data=True,
platforms='any',
classifiers = [
'Programming Language :: Python',
'Natural Language :: English'
]
)

The answer I found is this:
python3 setup.py bdist_wheel
doesn't write the results anyplace I can find them.
python3 setup.py bdist_wheel -d .
writes it, well, right here.

If I got you right, you search for resulting .whl file in ./build/... directory. But resulting files, both source distribution and wheel, usually by default get created in the ./dist/ directory, which is located near the build directory. Have you searched there?

Related

Building python package doesn't find requirements.txt

Its the first time that I have to use the content of an old git repository in the one that I'm actually working. I decided to try to create a Python Package of it to import in the new as a library (I am using gitlab).
I've searched info to do it but it is so hard to find a consistent solution.
I've first tried to build the package locally, by executing:
python setup.py bdist_wheel
And then:
python3 -m build
The package should build dependencies for wheel, but it crashes when trying to find the requirements.txt file.
I see previously that the command writes the egg-info files, creates the package, and copies files from local to the package:
(venv) acivit#odin:~/projects/mechanized-number-recognition$ python3 -m build
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting build dependencies for sdist...
running egg_info
writing acivit.mechanized_number_recognition.egg-info/PKG-INFO
writing dependency_links to acivit.mechanized_number_recognition.egg-info/dependency_links.txt
writing requirements to acivit.mechanized_number_recognition.egg-info/requires.txt
writing top-level names to acivit.mechanized_number_recognition.egg-info/top_level.txt
reading manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing acivit.mechanized_number_recognition.egg-info/PKG-INFO
writing dependency_links to acivit.mechanized_number_recognition.egg-info/dependency_links.txt
writing requirements to acivit.mechanized_number_recognition.egg-info/requires.txt
writing top-level names to acivit.mechanized_number_recognition.egg-info/top_level.txt
reading manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'acivit.mechanized_number_recognition.egg-info/SOURCES.txt'
running check
creating acivit.mechanized_number_recognition-0.0.3
creating acivit.mechanized_number_recognition-0.0.3/config
creating acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
creating acivit.mechanized_number_recognition-0.0.3/models
creating acivit.mechanized_number_recognition-0.0.3/utils
creating acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
copying files to acivit.mechanized_number_recognition-0.0.3...
copying LICENSE.md -> acivit.mechanized_number_recognition-0.0.3
copying README.md -> acivit.mechanized_number_recognition-0.0.3
copying setup.py -> acivit.mechanized_number_recognition-0.0.3
copying config/__init__.py -> acivit.mechanized_number_recognition-0.0.3
copying config/modules_config.py -> acivit.mechanized_number_recognition-0.0.3/config
copying acivit.mechanized_number_recognition.egg-info/PKG-INFO -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/SOURCES.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/dependency_links.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/not-zip-safe -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/requires.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying acivit.mechanized_number_recognition.egg-info/top_level.txt -> acivit.mechanized_number_recognition-0.0.3/acivit.mechanized_number_recognition.egg-info
copying models/__init__.py -> acivit.mechanized_number_recognition-0.0.3/models
copying models/common.py -> acivit.mechanized_number_recognition-0.0.3/models
copying models/experimental.py -> acivit.mechanized_number_recognition-0.0.3/models
copying models/yolo.py -> acivit.mechanized_number_recognition-0.0.3/models
copying utils/__init__.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/activations.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/add_nms.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/autoanchor.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/camera.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/datasets.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/general.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/google_utils.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/loss.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/metrics.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/plots.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/py_save.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/torch_utils.py -> acivit.mechanized_number_recognition-0.0.3/utils
copying utils/wandb_logging/__init__.py -> acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
copying utils/wandb_logging/log_dataset.py -> acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
copying utils/wandb_logging/wandb_utils.py -> acivit.mechanized_number_recognition-0.0.3/utils/wandb_logging
Writing acivit.mechanized_number_recognition-0.0.3/setup.cfg
Creating tar archive
removing 'acivit.mechanized_number_recognition-0.0.3' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting build dependencies for wheel...
Traceback (most recent call last):
File "/home/acivit/projects/mechanized-number-recognition/venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/acivit/projects/mechanized-number-recognition/venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/acivit/projects/mechanized-number-recognition/venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/tmp/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 484, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/build-env-6rchc20e/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 6, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
The project structure is:
MechanizedNumberPackage
README
requirements.txt
utils
config
models
main.py
The setup.py file:
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("requirements.txt", "r") as fh:
install_requires = fh.read()
setuptools.setup(
name="acivit.mechanized_number_recognition",
version="0.0.3",
author="Acivit",
description="`System to detect the Mechanized Number",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://gitlab.com/acivit/project/ai_systems/mechanized-number-recognition",
#  Disable zip_safe to allow compatibility with mypy.
# See: https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages
zip_safe=False,
package_data={"mechanized_number_recognition": ["py.typed"]},
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
install_requires=install_requires,
)
Any idea why this happens? Or any other method to build the package?
Thanks
Making a wild guess that your MANIFEST.in does not have requirements.txt in include.. something like this:
include *.md LICENSE requirements.txt CHANGELOG

"AttributeError: 'module' object has no attribute" with installed package

I have a project with these contents:
proj
├── src
│ ├── scriptA.py
│ ├── scriptB.py
│ └── __init__.py
├── LICENCE
├── README.md
└── setup.py
I am following this guide to package this project for PiPY. The setup.py file looks like:
#!/usr/bin/python3
# coding=utf8
from setuptools import setup
setup(
name = "proj",
version = "0.2",
packages = ['src'],
install_requires=[],
entry_points={
'console_scripts': [
'scriptA=src:scriptA',
'scriptB=src:scriptB'
],
},
# metadata for upload to PyPI
author = "Luís",
author_email = "luis#mail.com",
description = "Some package",
license = "EUPL v1.1",
keywords = "pip package",
url = "https://some.place.com", # project home page, if any
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: GIS"
],
# could also include long_description, download_url, classifiers, etc.
)
The __init__.py file contains the following:
__all__ = ["scriptA", "scriptB"]
The scripts just print text messages. This is scriptA.py:
def main():
print ("This is scriptA!")
main()
The packages is building sucessfully:
$ python3 setup.py bdist_wheel --universal
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/src
copying src/scriptA.py -> build/lib/src
copying src/__init__.py -> build/lib/src
copying src/scriptB.py -> build/lib/src
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/src
copying build/lib/src/scriptA.py -> build/bdist.linux-x86_64/wheel/src
copying build/lib/src/__init__.py -> build/bdist.linux-x86_64/wheel/src
copying build/lib/src/scriptB.py -> build/bdist.linux-x86_64/wheel/src
running install_egg_info
running egg_info
creating proj.egg-info
writing proj.egg-info/PKG-INFO
writing top-level names to proj.egg-info/top_level.txt
writing entry points to proj.egg-info/entry_points.txt
writing dependency_links to proj.egg-info/dependency_links.txt
writing manifest file 'proj.egg-info/SOURCES.txt'
reading manifest file 'proj.egg-info/SOURCES.txt'
writing manifest file 'proj.egg-info/SOURCES.txt'
Copying proj.egg-info to build/bdist.linux-x86_64/wheel/proj-0.1.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/proj-0.1.dist-info/WHEEL
I then installed it in a Python 3 virtual environment:
$ source ~/.virtualenvs/test_p3/bin/activate
(test_p3)$ python setup.py install
running install
running bdist_egg
running egg_info
writing dependency_links to proj.egg-info/dependency_links.txt
writing proj.egg-info/PKG-INFO
writing entry points to proj.egg-info/entry_points.txt
writing top-level names to proj.egg-info/top_level.txt
reading manifest file 'proj.egg-info/SOURCES.txt'
writing manifest file 'proj.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/src
copying build/lib/src/scriptA.py -> build/bdist.linux-x86_64/egg/src
copying build/lib/src/__init__.py -> build/bdist.linux-x86_64/egg/src
copying build/lib/src/scriptB.py -> build/bdist.linux-x86_64/egg/src
byte-compiling build/bdist.linux-x86_64/egg/src/scriptA.py to scriptA.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/src/__init__.py to __init__.cpython-34.pyc
byte-compiling build/bdist.linux-x86_64/egg/src/scriptB.py to scriptB.cpython-34.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying proj.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying proj.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying proj.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying proj.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying proj.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/proj-0.1-py3.4.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing proj-0.1-py3.4.egg
Copying proj-0.1-py3.4.egg to /home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages
Adding proj 0.1 to easy-install.pth file
Installing scriptA script to /home/desouslu/.virtualenvs/test_p3/bin
Installing scriptB script to /home/desouslu/.virtualenvs/test_p3/bin
Installed /home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/proj-0.1-py3.4.egg
Processing dependencies for proj==0.1
Finished processing dependencies for proj==0.1
But when I run one of the scripts I get the following:
(test_p3)$ scriptA
Traceback (most recent call last):
File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2051, in load
entry = getattr(entry,attr)
AttributeError: 'module' object has no attribute 'scriptA'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/desouslu/.virtualenvs/test_p3/bin/scriptA", line 9, in <module>
load_entry_point('proj==0.1', 'console_scripts', 'scriptA')()
File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 353, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2321, in load_entry_point
return ep.load()
File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2053, in load
raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'src' from '/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/hex_utils-0.2-py3.4.egg/src/__init__.py'> has no 'scriptA' attribute
What is exactly causing this error?
In your case it looks for scriptA callable in module src.
Looking at the docs, entry_points should be defined like:
entry_points={
'console_scripts': [
'scriptA=src.scriptA:main_func',
'scriptB=src.scriptB:main_func'
],
},
You should declarate your classes in __init__.py follow link

How to distribute type hints to PyPi?

I've worked on adding Python 3.5 type hints to the responses library. But when I test making a distribution, sdist or bdist_wheel, it doesn't install my .pyi file. I can see it being part of the distribution, but it doesn't go further than that.
You can see what I got in my repo here: https://github.com/gaqzi/responses/tree/feature/type-hints-file
I read PEP484 which mentions that stub files should be distributable. But I can't seem to figure out how. :)
Is there a problem because responses doesn't create a package? It's just a single module file and that's why it doesn't get added correctly?
What I see when I build the package:
% python setup.py sdist
running sdist
running egg_info
writing requirements to responses.egg-info/requires.txt
writing top-level names to responses.egg-info/top_level.txt
writing responses.egg-info/PKG-INFO
writing dependency_links to responses.egg-info/dependency_links.txt
reading manifest file 'responses.egg-info/SOURCES.txt'
writing manifest file 'responses.egg-info/SOURCES.txt'
running check
warning: check: missing meta-data: if 'author' supplied, 'author_email' must be supplied too
creating responses-0.6.0
creating responses-0.6.0/responses.egg-info
making hard links in responses-0.6.0...
hard linking README.rst -> responses-0.6.0
hard linking responses.py -> responses-0.6.0
hard linking responses.pyi -> responses-0.6.0
hard linking setup.cfg -> responses-0.6.0
hard linking setup.py -> responses-0.6.0
hard linking responses.egg-info/PKG-INFO -> responses-0.6.0/responses.egg-info
hard linking responses.egg-info/SOURCES.txt -> responses-0.6.0/responses.egg-info
hard linking responses.egg-info/dependency_links.txt -> responses-0.6.0/responses.egg-info
hard linking responses.egg-info/not-zip-safe -> responses-0.6.0/responses.egg-info
hard linking responses.egg-info/requires.txt -> responses-0.6.0/responses.egg-info
hard linking responses.egg-info/top_level.txt -> responses-0.6.0/responses.egg-info
copying setup.cfg -> responses-0.6.0
Writing responses-0.6.0/setup.cfg
Creating tar archive
removing 'responses-0.6.0' (and everything under it)
After I've installed the package I got this:
% pip install dist/responses-0.6.0.tar.gz
[...snip...]
Installing collected packages: responses
Successfully installed responses-0.6.0
% pwd
/Users/ba/.virtualenvs/responses/lib/python3.5/site-packages
% ls responses*
responses.py
responses-0.6.0.dist-info:
DESCRIPTION.rst METADATA RECORD WHEEL metadata.json top_level.txt
According to the mypy docs, you should pass package_data={"my_package": ["py.typed", "foo.pyi"]} as an argument to setup in setup.py. Note that "foo.pyi" is the relative path from the root of the package to be distributed to the
stub file (docs).
I've created an example repo where you can test this out at https://github.com/SKalt/stub_distrib_demo.

Why isn't py2exe creating an executable?

A few days ago I was able to create a Windows executable of my package using py2exe with no trouble. Today I tried again after completing deleting the build/ and dist/ folders and I don't see any errors, but I also don't get an executable in my dist/ folder. I do get these files in dist/:
_hashlib.pyd
bz2.pyd
library.zip
python27.dll
select.pyd
unicodedata.pyd
Here's my setup.py file:
from setuptools import setup
import py2exe
setup (
name = "RabbitToRaven",
version = "0.1",
description="RabbitToRaven is a utility for copying RabbitMQ messages into a RavenDB database.",
author="Greg Major",
author_email="", # Removed to limit spam harvesting.
url="http://www.gregmajor.com/",
packages=['RabbitToRaven'],
entry_points = {
'console_scripts': ['RabbitToRaven = RabbitToRaven.__main__:main']
},
download_url = "http://www.gregmajor.com/",
zip_safe = True
)
If I run $ python setup.py build with export DISTUTILS_DEBUG=1 then I get this:
options (after parsing config files):
options (after parsing command line):
option dict for 'aliases' command:
{}
option dict for 'build' command:
{'verbose': ('command line', 1)}
running build
Distribution.get_command_obj(): creating 'build' command object
setting options for 'build' command:
verbose = 1 (from command line)
running build_py
Distribution.get_command_obj(): creating 'build_py' command object
creating build
creating build\lib
creating build\lib\RabbitToRaven
copying RabbitToRaven\__init__.py -> build\lib\RabbitToRaven
copying RabbitToRaven\__main__.py -> build\lib\RabbitToRaven
Here's my python setup.py py2exe output:
options (after parsing config files):
options (after parsing command line):
option dict for 'aliases' command:
{}
option dict for 'py2exe' command:
{}
running py2exe
Distribution.get_command_obj(): creating 'py2exe' command object
Distribution.get_command_obj(): creating 'bdist' command object
Distribution.get_command_obj(): creating 'build' command object
setting options for 'build' command:
running build_py
Distribution.get_command_obj(): creating 'build_py' command object
creating build
creating build\lib
creating build\lib\RabbitToRaven
copying RabbitToRaven\__init__.py -> build\lib\RabbitToRaven
copying RabbitToRaven\__main__.py -> build\lib\RabbitToRaven
creating c:\Users\Greg\Code\LeadPipe.RabbitToRaven\build\bdist.win-amd64
creating c:\Users\Greg\Code\LeadPipe.RabbitToRaven\build\bdist.win-amd64\winexe
creating c:\Users\Greg\Code\LeadPipe.RabbitToRaven\build\bdist.win-amd64\winexe\collect-2.7
creating c:\Users\Greg\Code\LeadPipe.RabbitToRaven\build\bdist.win-amd64\winexe\bundle-2.7
creating c:\Users\Greg\Code\LeadPipe.RabbitToRaven\build\bdist.win-amd64\winexe\temp
creating c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist
*** searching for required modules ***
*** parsing results ***
creating python loader for extension 'unicodedata' (C:\tools\python2\DLLs\unicodedata.pyd -> unicodedata.pyd)
creating python loader for extension 'select' (C:\tools\python2\DLLs\select.pyd -> select.pyd)
creating python loader for extension '_hashlib' (C:\tools\python2\DLLs\_hashlib.pyd -> _hashlib.pyd)
creating python loader for extension 'bz2' (C:\tools\python2\DLLs\bz2.pyd -> bz2.pyd)
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
byte-compiling C:\tools\python2\Lib\StringIO.py to StringIO.pyc
snip!!!
byte-compiling c:\Users\Greg\Code\LeadPipe.RabbitToRaven\lib\warnings.py to warnings.pyc
*** copy extensions ***
copying C:\tools\python2\DLLs\_hashlib.pyd -> c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist
copying C:\tools\python2\DLLs\bz2.pyd -> c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist
copying C:\tools\python2\DLLs\select.pyd -> c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist
copying C:\tools\python2\DLLs\unicodedata.pyd -> c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist
*** copy dlls ***
copying C:\Windows\system32\python27.dll -> c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist
setting sys.winver for 'c:\Users\Greg\Code\LeadPipe.RabbitToRaven\dist\python27.dll' to 'RabbitToRaven'
*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.
USER32.dll - C:\Windows\system32\USER32.dll
SHELL32.dll - C:\Windows\system32\SHELL32.dll
ADVAPI32.dll - C:\Windows\system32\ADVAPI32.dll
WS2_32.dll - C:\Windows\system32\WS2_32.dll
GDI32.dll - C:\Windows\system32\GDI32.dll
KERNEL32.dll - C:\Windows\system32\KERNEL32.dll
Anybody have an idea? I'm pretty new to py2exe so I'm sure it's probably just a silly oversight. For what it's worth, my virtualenv environment is activated and I'm building from a Bash for Git terminal (although cmd.exe doesn't work either).
You aren't specifying which file should be made into an executable. Or at least not in a way that py2exe understands. entry_points and console_scripts seem to be options unique to setuptools.
Add either
console=['name_of_script.py']
or
windows=['name_of_script.py']
as a parameter to your setup() function inside the setup.py file. Depending on if you're creating a console or GUI application. These need to be lists, even if you're specifying only a single python script, although you can add more if you'd like.
Assuming you're creating a console application, your setup function should look something like this.
setup (
name = "RabbitToRaven",
version = "0.1",
console = ['name_of_script.py'],
...)
See http://www.py2exe.org/index.cgi/ListOfOptions for all the py2exe options.

setuptools removes the binary files , but keeps them in the tar

When i do
python setup.py bdist
for my python project folder.I find that it creates the dist, build folder but after it creates the egg/tar it deletes the binary.
How do i keep the binary files? I can see that it removes the build folder at the end.
running bdist
running bdist_dumb
running build
running build_py
creating build
creating build/lib
creating build/lib/my_project_folder
copying my_project_folder/__init__.py -> build/lib/my_project_folder
copying my_project_folder/my_script.py -> build/lib/my_project_folder
installing to build/bdist.linux-x86_64/dumb
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/dumb
creating build/bdist.linux-x86_64/dumb/usr
creating build/bdist.linux-x86_64/dumb/usr/lib
creating build/bdist.linux-x86_64/dumb/usr/lib/python2.6
creating build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages
creating build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder
copying build/lib/my_project_folder/__init__.py -> build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder
copying build/lib/my_project_folder/my_script.py -> build/bdist.linux-
byte-compiling build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder/my_script.py to my_script.pyc
running install_egg_info
running egg_info
creating my_project_folder.egg-info
writing requirements to my_project_folder.egg-info/requires.txt
writing my_project_folder.egg-info/PKG-INFO
writing top-level names to my_project_folder.egg-info/top_level.txt
writing dependency_links to my_project_folder.egg-info/dependency_links.txt
writing requirements to my_project_folder.egg-info/requires.txt
writing my_project_folder.egg-info/PKG-INFO
writing top-level names to my_project_folder.egg-info/top_level.txt
writing dependency_links to my_project_folder.egg-info/dependency_links.txt
writing manifest file 'my_project_folder.egg-info/SOURCES.txt'
reading manifest file 'my_project_folder.egg-info/SOURCES.txt'
writing manifest file 'my_project_folder.egg-info/SOURCES.txt'
Copying my_project_folder.egg-info to build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder-1.0.0_SNAPSHOT-py2.6.egg-info
running install_scripts
creating /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist
tar -cf /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar .
gzip -f9 /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar
tar -cf /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar .
gzip -f9 /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar
removing 'build/bdist.linux-x86_64/dumb' (and everything under it)
The problem i am trying to solve is to create a tar file of ONLY the binaries.
As of now able I am able to create the tar file with both *.py and *.pyc files(this comes by default with bdist command) I understand this is the feature of bdist command.
But i dont want the .py file in the end tar.
As long as i can get the access to the *.pyc files i can create the tar myself but setuptools doesnt let me keep it.
do both.
python setup.py bdist build
or
python setup.py bdist
python setup.py build

Categories

Resources