Private build requires and windows

123 views
Skip to first unread message

Sam Richards

unread,
Mar 3, 2017, 3:29:31 PM3/3/17
to rez-config
I'm trying to get a bunch of packages built on windows, mac and linux.

For windows, I need a special private_build_requires so I've tried:
private_build_requires = []

with variant("platform-windows") as v:
    private_build_requires += ['msvc-14', 'cmake']


which was mentioned somewhere, I also tried:
if system.platform == "windows":
    private_build_requires += ['msvc-14', 'cmake']

which only seems to work inside "commands", but not in the main area.

So I end up doing:

from platform import uname as unm
uname = unm()[0].lower()

if uname == "windows":
    private_build_requires += ['msvc-14', 'cmake']

Which just seems clunky. Is there another approach?

Sam.

Allan Johns

unread,
Mar 3, 2017, 3:36:06 PM3/3/17
to rez-c...@googlegroups.com
Hey Sam,

How are you creating the package... this looks like a bind module? Bind modules are fairly special case, they're just supposed to be a quick route to creating a package that uses existing software on the system.

Is this your own software you're packaging? If so you would just write a package.py and CMakeLists.txt as per usual, then rez-build/rez-release it.

(And yes - the 'system' object is only added to the globals namespace in commands() etc. But to use it elsewhere you would just use the rez API directly - ie, from rez.system import system).

Cheers
A



--
You received this message because you are subscribed to the Google Groups "rez-config" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+unsubscribe@googlegroups.com.
To post to this group, send email to rez-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/rez-config.
For more options, visit https://groups.google.com/d/optout.

Sam Richards

unread,
Mar 3, 2017, 3:51:18 PM3/3/17
to rez-config
The msvc-14 package is a bind module (we have other packages for visual studio 10-14), so I wanted a way to say that when I build this particular package I want to use the msvc-14 package.

And yes, the actual build is being done with cmake, I'm trying to make my way through the usd-build-club code rezifying it.

So for the bzip2 package its currently looking like:

from rez.system import system


name
= "bzip2"


version
= "1.0.6"


authors
= [
]


description
= \
   
"""
    bzip2 is a freely available, patent free (see below), high-quality data
    compressor. It typically compresses files to within 10% to 15% of the best
     available techniques (the PPM family of statistical compressors), whilst
     being around twice as fast at compression and six times faster at
     decompression.
    """



requires
= [


]


build_requires
= [
   
#"gcc-4.8.2"
]


variants
= [
   
['platform-linux', 'arch-x86_64', 'os-RedHatEnterpriseWorkstation-6.7'],
   
['platform-osx', 'arch-x86_64', 'os-osx-10.9'],
   
['platform-osx', 'arch-x86_64', 'os-osx-10.10'],
   
['platform-osx', 'arch-x86_64', 'os-osx-10.11'],
   
['platform-windows', 'arch-AMD64', 'os-windows-6.1.7601.SP1', 'target-AMD64'],
]


tools
= [




]


private_build_requires
= []



if system.platform == "windows":
    private_build_requires
+= ['msvc-14', 'cmake']



uuid
= "wdi.ext.bzip2"


def commands():
    env
.PATH.append("{root}/bin")
   
if system.platform == "windows":
        env
.PATH.append("{root}/lib")
    env
.LD_LIBRARY_PATH.append("{root}/lib")


Thanks for the quick response, it looks like the from.rez.system import system does help, I just want to be sure I'm doing it the right way.

Sam.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+...@googlegroups.com.

Allan Johns

unread,
Mar 3, 2017, 4:14:32 PM3/3/17
to rez-c...@googlegroups.com
Ah of course, I see what you're doing now.

There's no problem with this approach, but I bet that 'system' is getting installed with the package as an arbitrary attribute now... if so I'll have to fix this.

Another way to do what you're doing now (added recently) is like so (you'll need latest rez version):

@early()
def private_build_requires():
    if system.platform == "windows":
        return ['msvc-14', 'cmake']
    return []

Neither approach is better per se. The 'early' decorator here tells rez to turn the function into an attribute whose value is the return value, at build time.

Thx
A



To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+unsubscribe@googlegroups.com.

Allan Johns

unread,
Mar 3, 2017, 4:23:17 PM3/3/17
to rez-c...@googlegroups.com
Ah, this actually causes an error for me. Perhaps you're using an older version of rez that doesn't support arbitrary package attributes, in which case rez would not be attempting to keep 'system' as an attribute. I'll fix this just now.

Thx
A

Sam Richards

unread,
Mar 3, 2017, 5:16:45 PM3/3/17
to rez-config
Thanks Alan. I'll stick with my old scheme for a little longer, and then come back to clean it up.

Appreciate the quick response and the awsome work on rez!

sam.

Grégory Starck

unread,
Mar 10, 2017, 2:12:26 PM3/10/17
to rez-config
Hi,

you can just

del system

after you're done with it in the package.py file.

and rez won't see it then.
Reply all
Reply to author
Forward
0 new messages