pvjohnson / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

gyp should have a distutils setup.py script #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Like any python project, gyp should provide a setup.py script using
distutils.core.setup.

At the same time, gyp should have a version number, this is needed to be
packaged, for example by linux distros.

Excepted targets for setup.py are clean, build and install.
If possible, a check (or test) target would be nice to have too.

Original issue reported on code.google.com by f...@sofaraway.org on 21 Nov 2009 at 8:02

GoogleCodeExporter commented 9 years ago

Original comment by evan@chromium.org on 23 Nov 2009 at 9:51

GoogleCodeExporter commented 9 years ago
fta: http://codereview.chromium.org/460153

I cannot for the life of me figure out how distutils is supposed to install 
binaries! 
Does that look ok to you?

Original comment by a...@chromium.org on 9 Dec 2009 at 12:31

GoogleCodeExporter commented 9 years ago
(answering here rather than in CR)

On 2009/12/09 17:13:20, sgk wrote:
> Just hit me when I woke up, distutils knows how and where to install
> scripts

indeed, it does.

in Ubuntu/Debian packages, we call distutils via a dh_* script mostly from 
cdbs. The cdbs magic is in 
/usr/share/cdbs/1/class/python-distutils.mk.
There are two ways to package python apps now, pysupport and python-central. 
See 
http://wiki.debian.org/DebianPython/NewPolicy

I plan to use pysupport when it's supported, and fall back to pycentral 
otherwise

DEB_PYTHON_SYSTEM = pysupport
include /usr/share/cdbs/1/class/python-distutils.mk

this should result in something like:

python setup.py clean -a
python setup.py build --build-base="/build/buildd/pkg-vers/./build"
python setup.py build --build-base="/build/buildd/pkg-vers/./build"
python setup.py install --root=/build/buildd/pkg-vers/debian/pkg/ \
                --install-purelib=/usr/lib/python2.6/site-packages/ --prefix=/usr --no-compile -O0

or with pycentral:
DEB_PYTHON_SYSTEM = pycentral
include /usr/share/cdbs/1/class/python-distutils.mk
DEB_PYTHON_INSTALL_ARGS_ALL += --prefix=/usr

python setup.py clean -a
python setup.py build --build-base="/build/buildd/pkg-vers/./build"
touch python-build-stamp-2.5
python setup.py install --root=/build/buildd/pkg-vers/debian/pkg/ --no-compile 
-O0 --prefix=/usr

in both cases, the result is in 
/build/buildd/pkg-vers/debian/pkg/usr/{bin,lib/python2.6...}

Original comment by f...@sofaraway.org on 11 Dec 2009 at 3:56

GoogleCodeExporter commented 9 years ago
r767

Original comment by a...@chromium.org on 11 Dec 2009 at 7:32

GoogleCodeExporter commented 9 years ago
Thanks! it worked: gyp_0.1~svn767-0ubuntu1_all.deb

Could you bump the DEPS in Chromium please, it should be harmless.

The only thing troubling me is to keep the temporary sys.path.append hack in 
/usr/bin/gyp.
Could we move it in src/build/gyp_chromium somehow?

Original comment by f...@sofaraway.org on 11 Dec 2009 at 8:27

GoogleCodeExporter commented 9 years ago
Have rolled DEPS in Chromium. Can you explain the sys.path.append hack? I'll 
try to 
help but I don't think I know about this one.

Original comment by a...@chromium.org on 11 Dec 2009 at 9:08

GoogleCodeExporter commented 9 years ago
the main script starts with:

# TODO(mark): sys.path manipulation is some temporary testing stuff.
try:
  import gyp
except ImportError, e:
  import os.path
  sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
  import gyp

it's not really a problem as import is first and should always work in the 
package, 
but who knows what could happen. As it's mentioned as temporary, maybe it's 
time to 
drop it.

btw, just had a look at gyp_chromium, and it seems to already take of that.

Thanks for the DEPS.

Original comment by f...@sofaraway.org on 11 Dec 2009 at 9:15

GoogleCodeExporter commented 9 years ago
Since gyp_chromium already handles this, I think it's past due to remove the 
sys.path 
manipulation in gyp.py.

Original comment by mark@chromium.org on 11 Dec 2009 at 9:22

GoogleCodeExporter commented 9 years ago
Looks more difficult than i thought.
My immediate need for this system gyp is for my ffmpeg-codec package. I need to 
build the sumo lib made by awong in 
order to fix the media players bugs. But it seems gyp doesn't work outside of 
chromium:

$ GYP_DEFINES="ffmpeg_branding=Chromium" GYP_GENERATORS=make gyp ffmpeg.gyp
Traceback (most recent call last):
  File "/usr/bin/gyp", line 18, in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "/usr/lib/pymodules/python2.6/gyp/__init__.py", line 358, in main
    '--depth as a workaround.'
Exception: Could not automatically locate src directory.  This is a temporary 
Chromium feature that will be removed.  Use 
--depth as a workaround.

apparently, i need src/ and probably src/build/ to have common.gypi, and who 
know what else. Won't work for me if i have 
to pull half of chromium just to use gyp.
I'm unsure about what i should do now.

Original comment by f...@sofaraway.org on 12 Dec 2009 at 12:24

GoogleCodeExporter commented 9 years ago
update: it's almost ok without copying src/ by using:
GYP_DEFINES="target_arch=x64 chromeos=0 branding=Chromium 
library=static_library 
use_system_yasm=1 use_system_zlib=1 ffmpeg_branding=Chrome" GYP_GENERATORS=make 
gyp --
depth=. ffmpeg.gyp
It still doesn't build as the headers are generated elsewhere (but that's for 
another 
bug), and i've lost make install. But at least system gyp worked.

So there's hope after all.

Original comment by f...@sofaraway.org on 12 Dec 2009 at 2:28