Skip to contentSkip to conversation

scanpypi: new utility

PATCH New yegorslists at googlemail.com 2 participants 3 messages May 31, 2016 – Jun 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 scanpypi: new utility

From: Denis THULIN <[email protected]>

A utility for creating python package from the python package index. It fetches packages info from http://pypi.python.org and generates corresponding packages files.

---
Changes:

v0: initial commit
python-pacakage-generator.py is an utility for automatically generating a python package. It fetches packages info from http://pypi.python.org and generates corresponding packages files.

v1:
- renamed python-package-generator to scanpypi
- split the huge script into a lot of functions
- fixed mistakes and small bugs

v2:
- Rewrited most of the functions into a class
- Changed the method for importing setup.py
- Created a main function to avoid use of global variable
- Now adds new dependencies to the list of packages to create
- Droppped the .py extension

v3:
- Fixed bugs on import setup (Relative import works again)
- Can handle packages as zipfile
- Now avoids bdist packages
- Changed behaviour for packages that are not hosted on PyPI
- Added various clarifications of the code
- Works with: flask django robotframework pyxml pyzmq Twisted Six
- Does not work with: setuptools

v4:
- fix zipfile handling (Eelco Chaudron)
- improve documentation (add setuptools dependency etc.)

 docs/manual/adding-packages-python.txt |  45 +++
 support/scripts/scanpypi               | 653 +++++++++++++++++++++++++++++++++
 2 files changed, 698 insertions(+)
 create mode 100755 support/scripts/scanpypi
docs/manual/adding-packages-python.txt +45 -0
index 9bbc9f3..b2170dc 100644
@@ -7,6 +7,51 @@ This infrastructure applies to Python packages that use the standard
 Python setuptools mechanism as their build system, generally
 recognizable by the usage of a +setup.py+ script.
 
+[[scanpypi]]
+
+==== Generating a +python-package+ from a PyPI repository
+
+You may want to use the +scanpypi+ located in +support/script+ to generate a
+package from an existing PyPI package.
+
+You can find the list of existing PyPI packages https://pypi.python.org[here].
+
++scanpypi+ requires Python's +setuptools+ package to be installed on your host.
+
+Please keep in mind that you'll most likely have to manually check the package
+for any mistakes as there are things that cannot be guessed by the generator (e.g.
+dependencies on any of the python core modules such as BR2_PACKAGE_PYTHON_ZLIB).
+Also, please take note that the license and license files are guessed and must
+be checked. You also need to manually add the package to the +package/Config.in+
+file.
+
+When at the root of your buildroot directory just do :
+
+-----------------------
+./support/script/scanpypi foo bar -o package
+-----------------------
+
+This will generate packages +python-foo+ and +python-bar+ in the package
+folder if they exist on https://pypi.python.org.
+
+Find the +external python modules+ menu and insert your package inside.
+Keep in mind that the items inside a menu should be in alphabetical order.
+
+If your package is external, use the -o flag.
+
+-----------------------
+./support/script/scanpypi foo bar -o other_package_dir
+-----------------------
+
+This will generate packages +python-foo+ and +python-bar+ in the
++other_package_directory+ instead of +package+.
+
+Option +-h+ will list the available options.
+
+-----------------------
+./support/script/scanpypi -h
+-----------------------
+
 [[python-package-tutorial]]
 
 ==== +python-package+ tutorial
support/scripts/scanpypi new file +653 -0

653 lines not on this page · raw message

Signature · 1 line
2.8.1
#1 lore raw

PATCH v4 1/1 scanpypi: new utility

Hello,

Quoted 9 lines · yegorslists at googlemail.com

From: Denis THULIN <[email protected]>

A utility for creating python package from the python package index. It fetches packages info from http://pypi.python.org and generates corresponding packages files.

Thanks Yegor for this new version. If nobody complains or reviews it, I'll apply it in the next few days.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v4 1/1 scanpypi: new utility

In reply to yegorslists at googlemail.com

Hello,

Quoted 11 lines · yegorslists at googlemail.com

From: Denis THULIN <[email protected]>

A utility for creating python package from the python package index. It fetches packages info from http://pypi.python.org and generates corresponding packages files.

---
Changes:

I've done some minor tweaks in the documentation, and applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com