Your IP : 216.73.217.129
B
� f� � @ sj d Z ddlZddlZdd� Zedkrfeej�dkrPedejd f � e�d� eejd ejd � dS )
z�
A script that replaces an old file with a new one, only if the contents
actually changed. If not, the new file is simply deleted.
This avoids wholesale rebuilds when a code (re)generation phase does not
actually change the in-tree generated code.
� Nc C s` t | d��}|�� }W d Q R X t |d��}|�� }W d Q R X ||krRt�|| � n
t�|� d S )N�rb)�open�read�os�replace�unlink)Zold_path�new_path�fZold_contentsZnew_contents� r
�>/opt/alt/python37/lib64/python3.7/Tools/scripts/update_file.py�main
s r �__main__� z7Usage: %s <path to be updated> <path with new contents>� � ) �__doc__r �sysr �__name__�len�argv�print�exitr
r
r
r �<module> s